use core::fmt;
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub enum Error {
NotAligned {
address: usize,
alignment: usize,
},
EmptyArray,
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Error::NotAligned { alignment, address } => {
write!(
f,
"Address 0x{:X} is not {} byte aligned.",
address, alignment
)
}
Error::EmptyArray => write!(f, "Attempted to create an empty array accessor."),
}
}
}