pub struct T2miEvent { /* private fields */ }Expand description
One complete, CRC-valid T2-MI packet. Owns its bytes — 'static, cheap clone.
Only constructed after CRC-32 validation (ETSI TS 102 773 Annex A).
T2miEvent::header and T2miEvent::payload are lazy: they borrow from
the owned Bytes on demand.
Implementations§
Source§impl T2miEvent
impl T2miEvent
Sourcepub fn packet_type(&self) -> u8
pub fn packet_type(&self) -> u8
The raw packet_type byte (byte 0 of the T2-MI header per §5.1).
Never panics — events are only built for CRC-valid packets which are at
least 6 (header) + 4 (CRC) = 10 bytes.
Sourcepub fn header(&self) -> Result<Header>
pub fn header(&self) -> Result<Header>
Parse the 6-byte T2-MI packet header (lazy, borrows this event’s bytes).
§Errors
Propagates crate::Error from dvb_common::Parse::parse on Header.
Sourcepub fn payload(&self) -> Result<AnyPayload<'_>>
pub fn payload(&self) -> Result<AnyPayload<'_>>
Parse the payload by dispatching on packet_type.
Extracts the payload slice via Header::raw_payload_bytes (no
packet_type enum conversion), then calls
AnyPayload::dispatch. Unrecognised packet types produce
AnyPayload::Unknown with the raw payload bytes.
§Errors
Returns crate::Error from extracting the payload slice or from the
typed payload parser.
Sourcepub fn payload_with(&self, registry: &PayloadRegistry) -> Result<AnyPayload<'_>>
pub fn payload_with(&self, registry: &PayloadRegistry) -> Result<AnyPayload<'_>>
Parse the payload by dispatching on packet_type, preferring the
registry’s custom parsers over the built-in dispatch.
Like payload, but calls
AnyPayload::dispatch_with so that runtime-registered custom
packet types are resolved to AnyPayload::Other. Unrecognised
packet types produce AnyPayload::Unknown with the raw payload
bytes, exactly as payload does.
§Errors
Returns crate::Error from extracting the payload slice or from the
typed payload parser (built-in or custom).