Skip to main content

apple_accelerate/
error.rs

1pub type Result<T> = core::result::Result<T, Error>;
2
3#[derive(Debug, Clone, PartialEq, Eq)]
4pub enum Error {
5    InvalidLength { expected: usize, actual: usize },
6    OperationFailed(&'static str),
7    VImageError(isize),
8}
9
10impl core::fmt::Display for Error {
11    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
12        match self {
13            Self::InvalidLength { expected, actual } => {
14                write!(f, "invalid length: expected {expected}, got {actual}")
15            }
16            Self::OperationFailed(message) => f.write_str(message),
17            Self::VImageError(code) => write!(f, "vImage operation failed with status {code}"),
18        }
19    }
20}
21
22impl std::error::Error for Error {}