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("sync word mismatch: expected {expected:02X?}, found {found:02X?} (ST 12-1 §9.2.5)")]
SyncWordMismatch {
expected: [u8; 2],
found: [u8; 2],
},
#[error("field {field} value {value} invalid: {reason}")]
InvalidValue {
field: &'static str,
value: u8,
reason: &'static str,
},
#[error("binary group {index} value {value:#X} invalid: must be 0x0-0xF")]
InvalidBinaryGroup {
index: usize,
value: u8,
},
}