use core::fmt;
use std::error::Error;
use std::fmt::Display;
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
pub enum ParseApsFrameError {
MessageType(u8),
Profile(u16),
Fragmentation {
index: u8,
size: u8,
},
}
impl Display for ParseApsFrameError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::MessageType(msg_type) => write!(f, "Invalid message type: {msg_type}"),
Self::Profile(profile) => write!(f, "Invalid profile ID: {profile}"),
Self::Fragmentation { index, size } => write!(
f,
"Invalid fragmentation information: index: {index}, total fragments: {size}"
),
}
}
}
impl Error for ParseApsFrameError {}