laravel-image 0.2.0

Image handling and manipulation for Laravel Rust, in pure Rust: a port of intervention/image-laravel and Intervention Image.
Documentation
//! The package's errors: one variant per exception of Intervention Image that the port throws.

/// An image couldn't be decoded, modified, encoded or saved.
///
/// Each variant is the exception of the same name in Intervention Image 4
/// (`InvalidArgumentException`, `NotSupportedException`, ...).
#[derive(Debug, thiserror::Error)]
pub enum ImageError {
    /// An argument is out of range or malformed: `InvalidArgumentException`.
    #[error("{0}")]
    InvalidArgument(String),
    /// The format, media type or input isn't supported: `NotSupportedException`.
    #[error("{0}")]
    NotSupported(String),
    /// The directory of a path doesn't exist: `DirectoryNotFoundException`.
    #[error("{0}")]
    DirectoryNotFound(String),
    /// The file doesn't exist: `FileNotFoundException`.
    #[error("{0}")]
    FileNotFound(String),
    /// The file can't be read: `FileNotReadableException`.
    #[error("{0}")]
    FileNotReadable(String),
    /// The file can't be written: `FileNotWritableException`.
    #[error("{0}")]
    FileNotWritable(String),
    /// The data isn't an image the driver can decode: `ImageDecoderException`.
    #[error("{0}")]
    Decoder(String),
    /// The image couldn't be encoded: `EncoderException`.
    #[error("{0}")]
    Encoder(String),
    /// A color string couldn't be decoded: `ColorDecoderException`.
    #[error("{0}")]
    ColorDecoder(String),
}

/// The result of the package's operations.
pub type Result<T, E = ImageError> = std::result::Result<T, E>;

pub(crate) fn invalid(message: impl Into<String>) -> ImageError {
    ImageError::InvalidArgument(message.into())
}