#[cfg(not(feature = "std"))]
use core::fmt;
#[cfg(feature = "std")]
use std::fmt;
#[derive(Debug)]
pub struct BitfieldSliceError(
pub usize,
pub usize
);
impl fmt::Display for BitfieldSliceError {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
fmt,
"Expected {} bytes, {} bytes were provided.",
self.1, self.0
)
}
}
#[cfg(feature = "std")]
impl std::error::Error for BitfieldSliceError {}
#[derive(Debug)]
pub struct BitfieldHexError(
pub char,
pub usize
);
impl fmt::Display for BitfieldHexError {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
fmt,
"Found Invalid character {} @ index {}.",
self.0, self.1
)
}
}