use core::fmt;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Error {
InvalidLength { expected: usize, actual: usize },
}
pub type Result<T> = core::result::Result<T, Error>;
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::InvalidLength { expected, actual } => {
write!(
f,
"buffer too small: expected at least {expected} bytes, got {actual}"
)
}
}
}
}
impl std::error::Error for Error {}