Skip to main content

AnyTableSection

Enum AnyTableSection 

Source
#[non_exhaustive]
pub enum AnyTableSection<'a> {
Show 29 variants PatSection(PatSection), CatSection(CatSection<'a>), PmtSection(PmtSection<'a>), TsdtSection(TsdtSection<'a>), DsmccSection(DsmccSection<'a>), NitSection(NitSection<'a>), SdtSection(SdtSection<'a>), BatSection(BatSection<'a>), UntSection(UntSection<'a>), IntSection(IntSection<'a>), SatSection(SatSection<'a>), EitSection(EitSection<'a>), TdtSection(TdtSection), RstSection(RstSection), StSection(StSection), TotSection(TotSection<'a>), AitSection(AitSection<'a>), ContainerSection(ContainerSection<'a>), RctSection(RctSection<'a>), CitSection(CitSection<'a>), MpeFecSection(MpeFecSection<'a>), RntSection(RntSection<'a>), MpeIfecSection(MpeIfecSection<'a>), ProtectionMessage(ProtectionMessageSection<'a>), DownloadableFontInfo(DownloadableFontInfoSection<'a>), DitSection(DitSection), SitSection(SitSection<'a>), MpeDatagram(MpeDatagramSection<'a>), Unknown { table_id: u8, raw: &'a [u8], },
}
Expand description

Every crate-implemented table-section parser, plus an Unknown fallthrough.

serde uses external tagging with camelCase variant keys — a parsed PAT section serializes as {"patSection": {…}}. Variant names map 1:1 to section parser types; 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 AnyTableSection::parse_as::<MpeDatagramSection> or MpeDatagramSection::parse directly; the MpeDatagram variant exists in this enum for API completeness but is never produced by AnyTableSection::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.
§

PatSection(PatSection)

§

CatSection(CatSection<'a>)

§

PmtSection(PmtSection<'a>)

§

TsdtSection(TsdtSection<'a>)

§

DsmccSection(DsmccSection<'a>)

§

NitSection(NitSection<'a>)

§

SdtSection(SdtSection<'a>)

§

BatSection(BatSection<'a>)

§

UntSection(UntSection<'a>)

§

IntSection(IntSection<'a>)

§

SatSection(SatSection<'a>)

§

EitSection(EitSection<'a>)

§

TdtSection(TdtSection)

§

RstSection(RstSection)

§

StSection(StSection)

§

TotSection(TotSection<'a>)

§

AitSection(AitSection<'a>)

§

ContainerSection(ContainerSection<'a>)

§

RctSection(RctSection<'a>)

§

CitSection(CitSection<'a>)

§

MpeFecSection(MpeFecSection<'a>)

§

RntSection(RntSection<'a>)

§

MpeIfecSection(MpeIfecSection<'a>)

§

ProtectionMessage(ProtectionMessageSection<'a>)

§

DownloadableFontInfo(DownloadableFontInfoSection<'a>)

§

DitSection(DitSection)

§

SitSection(SitSection<'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> AnyTableSection<'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 AnyTableSection::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(AnyTableSection::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::AnyTableSection;
use dvb_si::tables::mpe::MpeDatagramSection;

// A deliberately-too-short slice: parse_as propagates the
// BufferTooShort error from MpeDatagramSection::parse.
let err = AnyTableSection::parse_as::<MpeDatagramSection>(&[0x3E, 0x00]);
assert!(err.is_err());
§Errors

Propagates T::parse errors.

Trait Implementations§

Source§

impl<'a> Debug for AnyTableSection<'a>

Source§

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

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

impl<'a> From<AitSection<'a>> for AnyTableSection<'a>

Source§

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

Converts to this type from the input type.
Source§

impl<'a> From<BatSection<'a>> for AnyTableSection<'a>

Source§

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

Converts to this type from the input type.
Source§

impl<'a> From<CatSection<'a>> for AnyTableSection<'a>

Source§

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

Converts to this type from the input type.
Source§

impl<'a> From<CitSection<'a>> for AnyTableSection<'a>

Source§

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

Converts to this type from the input type.
Source§

impl<'a> From<ContainerSection<'a>> for AnyTableSection<'a>

Source§

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

Converts to this type from the input type.
Source§

impl<'a> From<DitSection> for AnyTableSection<'a>

Source§

fn from(t: DitSection) -> Self

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

impl<'a> From<EitSection<'a>> for AnyTableSection<'a>

Source§

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

Converts to this type from the input type.
Source§

impl<'a> From<IntSection<'a>> for AnyTableSection<'a>

Source§

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

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

impl<'a> From<MpeFecSection<'a>> for AnyTableSection<'a>

Source§

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

Converts to this type from the input type.
Source§

impl<'a> From<MpeIfecSection<'a>> for AnyTableSection<'a>

Source§

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

Converts to this type from the input type.
Source§

impl<'a> From<NitSection<'a>> for AnyTableSection<'a>

Source§

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

Converts to this type from the input type.
Source§

impl<'a> From<PatSection> for AnyTableSection<'a>

Source§

fn from(t: PatSection) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<PmtSection<'a>> for AnyTableSection<'a>

Source§

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

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

impl<'a> From<RctSection<'a>> for AnyTableSection<'a>

Source§

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

Converts to this type from the input type.
Source§

impl<'a> From<RntSection<'a>> for AnyTableSection<'a>

Source§

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

Converts to this type from the input type.
Source§

impl<'a> From<RstSection> for AnyTableSection<'a>

Source§

fn from(t: RstSection) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<SatSection<'a>> for AnyTableSection<'a>

Source§

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

Converts to this type from the input type.
Source§

impl<'a> From<SdtSection<'a>> for AnyTableSection<'a>

Source§

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

Converts to this type from the input type.
Source§

impl<'a> From<SitSection<'a>> for AnyTableSection<'a>

Source§

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

Converts to this type from the input type.
Source§

impl<'a> From<StSection> for AnyTableSection<'a>

Source§

fn from(t: StSection) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<TdtSection> for AnyTableSection<'a>

Source§

fn from(t: TdtSection) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<TotSection<'a>> for AnyTableSection<'a>

Source§

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

Converts to this type from the input type.
Source§

impl<'a> From<TsdtSection<'a>> for AnyTableSection<'a>

Source§

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

Converts to this type from the input type.
Source§

impl<'a> From<UntSection<'a>> for AnyTableSection<'a>

Source§

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

Converts to this type from the input type.
Source§

impl<'a> Serialize for AnyTableSection<'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 AnyTableSection<'static>

Source§

type Output = AnyTableSection<'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 AnyTableSection<'a>

§

impl<'a> RefUnwindSafe for AnyTableSection<'a>

§

impl<'a> Send for AnyTableSection<'a>

§

impl<'a> Sync for AnyTableSection<'a>

§

impl<'a> Unpin for AnyTableSection<'a>

§

impl<'a> UnsafeUnpin for AnyTableSection<'a>

§

impl<'a> UnwindSafe for AnyTableSection<'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.