Add `convert.rs`: a SIMD nearest-color search and a rayon-parallel `nordify_pixels` function. Add `error.rs` with the `NordifyError` type. Rewrite `lib.rs` to expose `NordifyOptions`, `nordify_image`, and `nordify_file` as the public API. Rewrite `main.rs` to parse CLI arguments with `argh` and call into `lib.rs`. Add `argh` and `thiserror` as dependencies.
10 lines
222 B
Rust
10 lines
222 B
Rust
use thiserror::Error;
|
|
|
|
#[derive(Debug, Error)]
|
|
pub enum NordifyError {
|
|
#[error("failed to read or write image: {0}")]
|
|
Image(#[from] image::ImageError),
|
|
}
|
|
|
|
pub type Result<T> = std::result::Result<T, NordifyError>;
|