image-ndarray 0.1.5

Zero-copy implementations for the Image crate to convert to and from ndarrays
Documentation
use thiserror::Error;

/// Global error object for the image-ndarray crate.
#[derive(Debug, Error, PartialEq)]
pub enum Error {
    #[cfg(feature = "image")]
    #[error("NDArray had an error during initializaiton of shape: {0}")]
    NDArray(#[from] ndarray::ShapeError),
    #[error("Image could not be constructed from ndarray.")]
    ImageConstructFailed,
    #[error(
        "Image could not be constructed from ndarray because output does not match input channel count."
    )]
    ChannelMismatch,
    #[error("Only 2d and 3d arrays are supported.")]
    Dimensions,
}

#[cfg(feature = "image")]
pub type Result<T> = core::result::Result<T, Error>;