#[non_exhaustive]pub enum AnyTable<'a> {
Show 29 variants
Pat(Pat),
Cat(Cat),
Pmt(Pmt<'a>),
Tsdt(Tsdt),
DsmccSection(DsmccSection<'a>),
Nit(Nit<'a>),
Sdt(Sdt<'a>),
Bat(Bat<'a>),
Unt(Unt<'a>),
Int(Int<'a>),
Sat(Sat<'a>),
Eit(Eit<'a>),
Tdt(Tdt),
Rst(Rst),
St(St),
Tot(Tot<'a>),
Ait(Ait<'a>),
Container(Container<'a>),
Rct(Rct<'a>),
Cit(Cit<'a>),
MpeFec(MpeFec<'a>),
Rnt(Rnt<'a>),
MpeIfec(MpeIfec<'a>),
ProtectionMessage(ProtectionMessageSection<'a>),
DownloadableFontInfo(DownloadableFontInfoSection<'a>),
Dit(Dit),
Sit(Sit),
MpeDatagram(MpeDatagramSection<'a>),
Unknown {
table_id: u8,
raw: &'a [u8],
},
}Expand description
Every crate-implemented table, plus an Unknown fallthrough.
serde uses external tagging with camelCase variant keys — a parsed
PAT serializes as {"pat": {…}}.
Variant names map 1:1 to the table modules; see each module for the
wire layout.
0x3E (datagram_section) is routed to DsmccSection by the
default dispatcher. The typed MPE view is reachable via
AnyTable::parse_as::<MpeDatagramSection> or
MpeDatagramSection::parse directly; the MpeDatagram variant
exists in this enum for API completeness but is never produced by
AnyTable::parse.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Pat(Pat)
Cat(Cat)
Pmt(Pmt<'a>)
Tsdt(Tsdt)
DsmccSection(DsmccSection<'a>)
Nit(Nit<'a>)
Sdt(Sdt<'a>)
Bat(Bat<'a>)
Unt(Unt<'a>)
Int(Int<'a>)
Sat(Sat<'a>)
Eit(Eit<'a>)
Tdt(Tdt)
Rst(Rst)
St(St)
Tot(Tot<'a>)
Ait(Ait<'a>)
Container(Container<'a>)
Rct(Rct<'a>)
Cit(Cit<'a>)
MpeFec(MpeFec<'a>)
Rnt(Rnt<'a>)
MpeIfec(MpeIfec<'a>)
ProtectionMessage(ProtectionMessageSection<'a>)
DownloadableFontInfo(DownloadableFontInfoSection<'a>)
Dit(Dit)
Sit(Sit)
MpeDatagram(MpeDatagramSection<'a>)
Unknown
table_id with no typed implementation; raw is the full
section bytes including the table_id header.
Implementations§
Source§impl<'a> AnyTable<'a>
impl<'a> AnyTable<'a>
Sourcepub const DISPATCHED_RANGES: &'static [(u8, u8)]
pub const DISPATCHED_RANGES: &'static [(u8, u8)]
All table_id ranges covered by the auto-dispatcher (excludes
@no_dispatch variants). Each entry is (lo, hi) inclusive.
Sourcepub fn parse(bytes: &'a [u8]) -> Result<Self>
pub fn parse(bytes: &'a [u8]) -> Result<Self>
Dispatch one complete section by its table_id (byte 0).
Returns Err(BufferTooShort) when bytes is empty.
Unknown table_ids produce Ok(AnyTable::Unknown { … }).
§Errors
crate::Error::BufferTooShort—bytesis empty.- Any parse error from the dispatched type.
Sourcepub fn parse_as<T>(bytes: &'a [u8]) -> Result<T>where
T: TableDef<'a>,
pub fn parse_as<T>(bytes: &'a [u8]) -> Result<T>where
T: TableDef<'a>,
Type-keyed parse: bypass the dispatcher and parse bytes
directly as T. Useful for types excluded from the default
dispatch, e.g.:
use dvb_si::tables::AnyTable;
use dvb_si::tables::mpe::MpeDatagramSection;
// A deliberately-too-short slice: parse_as propagates the
// BufferTooShort error from MpeDatagramSection::parse.
let err = AnyTable::parse_as::<MpeDatagramSection>(&[0x3E, 0x00]);
assert!(err.is_err());§Errors
Propagates T::parse errors.