pub type Result<T> = core::result::Result<T, Error>;
#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
#[error("buffer too short: need {need}, have {have} ({what})")]
BufferTooShort {
need: usize,
have: usize,
what: &'static str,
},
#[error("serialize: output buffer too small — need {need}, have {have}")]
OutputBufferTooSmall {
need: usize,
have: usize,
},
#[error("field {field} value {value} invalid: {reason}")]
InvalidValue {
field: &'static str,
value: u64,
reason: &'static str,
},
#[error("invalid input: {0}")]
InvalidInput(&'static str),
}