use core::fmt;
use core::num::NonZeroUsize;
#[derive(Debug, Clone, Copy)]
pub enum Error {
InsufficientData {
missing: NonZeroUsize,
},
Overflow,
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::InsufficientData {
missing: remaining_bytes,
} => write!(
f,
"Insufficient data, need {remaining_bytes} bytes to complete the operation.",
),
Self::Overflow => write!(f, "Overflow occurred during length calculation."),
}
}
}