Skip to main content

AnyTable

Enum AnyTable 

Source
#[non_exhaustive]
pub enum AnyTable<'a> {
Show 29 variants Pat(Pat), Cat(Cat<'a>), Pmt(Pmt<'a>), Tsdt(Tsdt<'a>), 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<'a>), 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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Pat(Pat)

§

Cat(Cat<'a>)

§

Pmt(Pmt<'a>)

§

Tsdt(Tsdt<'a>)

§

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<'a>)

§

MpeDatagram(MpeDatagramSection<'a>)

§

Unknown

table_id with no typed implementation; raw is the full section bytes including the table_id header.

Fields

§table_id: u8

The raw table_id byte.

§raw: &'a [u8]

The raw section bytes (full, header included).

Implementations§

Source§

impl<'a> AnyTable<'a>

Source

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.

Source

pub fn name(&self) -> &'static str

Diagnostic name of the contained table — the type’s TableDef::NAME ("EVENT_INFORMATION", "PROGRAM_ASSOCIATION", …); "UNKNOWN" for AnyTable::Unknown.

Source

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
Source

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.

Trait Implementations§

Source§

impl<'a> Debug for AnyTable<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> From<Ait<'a>> for AnyTable<'a>

Source§

fn from(t: Ait<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Bat<'a>> for AnyTable<'a>

Source§

fn from(t: Bat<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Cat<'a>> for AnyTable<'a>

Source§

fn from(t: Cat<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Cit<'a>> for AnyTable<'a>

Source§

fn from(t: Cit<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Container<'a>> for AnyTable<'a>

Source§

fn from(t: Container<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Dit> for AnyTable<'a>

Source§

fn from(t: Dit) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<DownloadableFontInfoSection<'a>> for AnyTable<'a>

Source§

fn from(t: DownloadableFontInfoSection<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<DsmccSection<'a>> for AnyTable<'a>

Source§

fn from(t: DsmccSection<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Eit<'a>> for AnyTable<'a>

Source§

fn from(t: Eit<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Int<'a>> for AnyTable<'a>

Source§

fn from(t: Int<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<MpeDatagramSection<'a>> for AnyTable<'a>

Source§

fn from(t: MpeDatagramSection<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<MpeFec<'a>> for AnyTable<'a>

Source§

fn from(t: MpeFec<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<MpeIfec<'a>> for AnyTable<'a>

Source§

fn from(t: MpeIfec<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Nit<'a>> for AnyTable<'a>

Source§

fn from(t: Nit<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Pat> for AnyTable<'a>

Source§

fn from(t: Pat) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Pmt<'a>> for AnyTable<'a>

Source§

fn from(t: Pmt<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<ProtectionMessageSection<'a>> for AnyTable<'a>

Source§

fn from(t: ProtectionMessageSection<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Rct<'a>> for AnyTable<'a>

Source§

fn from(t: Rct<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Rnt<'a>> for AnyTable<'a>

Source§

fn from(t: Rnt<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Rst> for AnyTable<'a>

Source§

fn from(t: Rst) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Sat<'a>> for AnyTable<'a>

Source§

fn from(t: Sat<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Sdt<'a>> for AnyTable<'a>

Source§

fn from(t: Sdt<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Sit<'a>> for AnyTable<'a>

Source§

fn from(t: Sit<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<St> for AnyTable<'a>

Source§

fn from(t: St) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Tdt> for AnyTable<'a>

Source§

fn from(t: Tdt) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Tot<'a>> for AnyTable<'a>

Source§

fn from(t: Tot<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Tsdt<'a>> for AnyTable<'a>

Source§

fn from(t: Tsdt<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<Unt<'a>> for AnyTable<'a>

Source§

fn from(t: Unt<'a>) -> Self

Converts to this type from the input type.
Source§

impl<'a> Serialize for AnyTable<'a>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a> Yokeable<'a> for AnyTable<'static>

Source§

type Output = AnyTable<'a>

This type MUST be Self with the 'static replaced with 'a, i.e. Self<'a>
Source§

fn transform(&'a self) -> &'a Self::Output

This method must cast self between &'a Self<'static> and &'a Self<'a>. Read more
Source§

fn transform_owned(self) -> Self::Output

This method must cast self between Self<'static> and Self<'a>. Read more
Source§

unsafe fn make(this: Self::Output) -> Self

This method can be used to cast away Self<'a>’s lifetime. Read more
Source§

fn transform_mut<F>(&'a mut self, f: F)
where F: 'static + for<'b> FnOnce(&'b mut Self::Output),

This method must cast self between &'a mut Self<'static> and &'a mut Self<'a>, and pass it to f. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for AnyTable<'a>

§

impl<'a> RefUnwindSafe for AnyTable<'a>

§

impl<'a> Send for AnyTable<'a>

§

impl<'a> Sync for AnyTable<'a>

§

impl<'a> Unpin for AnyTable<'a>

§

impl<'a> UnsafeUnpin for AnyTable<'a>

§

impl<'a> UnwindSafe for AnyTable<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> DescriptorObject for T
where T: Debug + Any + Send + Sync + Serialize,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Borrow as &dyn Any so the caller can downcast to the concrete type.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.