yuv/
error.rs

1use core::fmt;
2
3#[cfg(not(any(not(feature = "std"), feature = "no_std")))]
4use std::error;
5#[cfg(any(not(feature = "std"), feature = "no_std"))]
6use core::error;
7
8/// This library doesn't support all combinations of color spaces
9#[derive(Debug, Copy, Clone)]
10pub enum Error {
11    UnsupportedTransferCharacteristics,
12    UnsupportedMatrixCoefficients,
13    InvalidDepthRequested,
14}
15
16impl error::Error for Error {}
17
18impl fmt::Display for Error {
19    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
20        f.write_str(match self {
21            Self::UnsupportedTransferCharacteristics => "Unsupported color space (transfer characteristics)",
22            Self::UnsupportedMatrixCoefficients => "Unsupported color space (matrix coefficients)",
23            Self::InvalidDepthRequested => "16-bit converter was asked to convert 8-bit color",
24        })
25    }
26}