base line EOF model
All checks were successful
Rust/spacepackets/pipeline/pr-main This commit looks good
Rust/spacepackets/pipeline/head This commit looks good

This commit is contained in:
2023-06-07 01:12:07 +02:00
parent 0b714b7426
commit 912c03b5c7
5 changed files with 112 additions and 5 deletions

View File

@ -140,6 +140,10 @@ pub const NULL_CHECKSUM_U32: [u8; 4] = [0; 4];
pub enum TlvLvError {
DataTooLarge(usize),
ByteConversionError(ByteConversionError),
/// First value: Found value. Second value: Expected value.
InvalidTlvTypeField((u8, u8)),
/// Logically invalid value length detected.
InvalidValueLength(u8),
}
impl From<ByteConversionError> for TlvLvError {
@ -162,6 +166,15 @@ impl Display for TlvLvError {
TlvLvError::ByteConversionError(e) => {
write!(f, "{}", e)
}
TlvLvError::InvalidTlvTypeField((found, expected)) => {
write!(
f,
"invalid TLV type field, found {found}, expected {expected}"
)
}
TlvLvError::InvalidValueLength(len) => {
write!(f, "invalid value length {len} detected")
}
}
}
}