#[non_exhaustive]pub enum Error {
BufferTooShort(BufferTooShort),
CrcMismatch(CrcMismatch),
UnexpectedTableId {
table_id: u8,
what: &'static str,
expected: &'static [u8],
},
InvalidDescriptor {
tag: u8,
reason: &'static str,
},
ValueOutOfRange {
field: &'static str,
reason: &'static str,
},
SectionLengthOverflow {
declared: usize,
available: usize,
},
ReservedBits(ReservedBits),
InvalidValue(InvalidValue),
InvalidField(InvalidField),
OutputBufferTooSmall(OutputBufferTooSmall),
InvalidSync(InvalidSync),
FieldOverflow(FieldOverflow),
}Expand description
Error variants that parsers + builders can return.
Spec references inside #[error(...)] strings quote clauses from
ETSI EN 300 468 v1.19.1 where applicable.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
BufferTooShort(BufferTooShort)
Input buffer was shorter than the smallest valid encoding for the type.
CrcMismatch(CrcMismatch)
CRC-32 validation failed for a table section.
UnexpectedTableId
table_id byte doesn’t match any expected value for the parser invoked.
Fields
InvalidDescriptor
Descriptor payload failed semantic validation.
ValueOutOfRange
A decoded value passed to a set_* accessor could not be encoded to the
field’s fixed wire representation (e.g. a duration ≥ 100 hours, or a date
outside the 16-bit MJD range).
SectionLengthOverflow
A section_length declared more bytes than the containing buffer could hold.
Fields
ReservedBits(ReservedBits)
A reserved or fixed-value bit group was not in the state a spec clause requires. Most parsers are permissive about reserved bits; this is only emitted when a clause specifically requires a value.
InvalidValue(InvalidValue)
A field held a value its spec clause forbids.
InvalidField(InvalidField)
A field is structurally invalid with no single offending number.
OutputBufferTooSmall(OutputBufferTooSmall)
Write buffer passed to serialize_into was smaller than serialized_len().
InvalidSync(InvalidSync)
A fixed marker did not match (TS sync byte, expected 0x47).
FieldOverflow(FieldOverflow)
A serializer’s length or count value did not fit its wire field.
Returned instead of silently narrowing (as u8/as u16/masking),
which would emit a misframed section (see #1129).
Trait Implementations§
impl Eq for Error
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()