Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 13 variants BufferTooShort(BufferTooShort), CrcMismatch(CrcMismatch), InvalidSync(InvalidSync), OutputBufferTooSmall(OutputBufferTooSmall),
#[non_exhaustive]
SectionLengthOverflow { declared: usize, available: usize, },
#[non_exhaustive]
PayloadTooLarge { len: usize, max: usize, }, ClockOutOfRange(ClockOutOfRange), FieldOverflow(FieldOverflow), NoAdaptationField,
#[non_exhaustive]
NoClockReference { which: &'static str, },
#[non_exhaustive]
AdaptationFieldTooShort { need: usize, have: usize, },
#[non_exhaustive]
DescriptorHeaderTruncated { offset: usize, need: usize, have: usize, },
#[non_exhaustive]
DescriptorBodyTruncated { offset: usize, tag: u8, declared: usize, have: usize, },
}
Expand description

Error variants that parsers + builders can return.

Spec references inside #[error(...)] strings quote clauses from ITU-T H.222.0 (= ISO/IEC 13818-1) where applicable.

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.
§

BufferTooShort(BufferTooShort)

Input buffer was shorter than the smallest valid encoding for the type.

§

CrcMismatch(CrcMismatch)

CRC-32 validation failed for a table section.

§

InvalidSync(InvalidSync)

A fixed marker did not match (TS sync byte, expected 0x47).

§

OutputBufferTooSmall(OutputBufferTooSmall)

Write buffer passed to serialize_into was smaller than serialized_len().

§

#[non_exhaustive]
SectionLengthOverflow

A section_length declared more bytes than the containing buffer could hold.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§declared: usize

Length bytes declared inside the section header.

§available: usize

Bytes actually available after the header.

§

#[non_exhaustive]
PayloadTooLarge

A payload was longer than a single TS packet’s fixed payload capacity (see OwnedTsPacket::serialize_with_payload, #1129).

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§len: usize

The payload length that did not fit.

§max: usize

The maximum payload capacity.

§

ClockOutOfRange(ClockOutOfRange)

A PCR or ESCR value did not fit the 27 MHz clock: a base wider than 33 bits, or an extension >= 300 (the 9-bit wire field can carry 300..=511).

§

FieldOverflow(FieldOverflow)

A length or count field’s value does not fit its wire field (see broadcast_core::len, #1129).

§

NoAdaptationField

The packet has no adaptation field, so it has no PCR (and no OPCR) slot to rewrite.

§

#[non_exhaustive]
NoClockReference

The adaptation field has no PCR (or OPCR) slot: either it is shorter than the flags byte plus the 6-byte field, or the packet’s own flag byte does not set the corresponding flag.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§which: &'static str

The missing field: "PCR" or "OPCR".

§

#[non_exhaustive]
AdaptationFieldTooShort

The adaptation field is shorter than the field being written into it.

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§need: usize

Bytes the write needs.

§have: usize

adaptation_field_length the packet declares.

§

#[non_exhaustive]
DescriptorHeaderTruncated

A descriptor loop ends with fewer bytes than a descriptor() header (ISO/IEC 13818-1 §2.6).

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§offset: usize

Offset of the truncated header inside the loop.

§need: usize

Bytes the header needs.

§have: usize

Bytes left in the loop from that offset.

§

#[non_exhaustive]
DescriptorBodyTruncated

A descriptor declares a descriptor_length that runs past the end of its loop (ISO/IEC 13818-1 §2.6).

Fields

This variant is marked as non-exhaustive
Non-exhaustive enum variants could have additional fields added in future. Therefore, non-exhaustive enum variants cannot be constructed in external crates and cannot be matched against.
§offset: usize

Offset of the descriptor header inside the loop.

§tag: u8

Its descriptor_tag.

§declared: usize

Its declared descriptor_length.

§have: usize

Body bytes actually left in the loop.

Trait Implementations§

Source§

impl Clone for Error

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Eq for Error

Source§

impl Error for Error

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Replaced by Error::source.
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<BufferTooShort> for Error

Source§

fn from(source: BufferTooShort) -> Self

Converts to this type from the input type.
Source§

impl From<ClockOutOfRange> for Error

Source§

fn from(source: ClockOutOfRange) -> Self

Converts to this type from the input type.
Source§

impl From<CrcMismatch> for Error

Source§

fn from(source: CrcMismatch) -> Self

Converts to this type from the input type.
Source§

impl From<FieldOverflow> for Error

Source§

fn from(source: FieldOverflow) -> Self

Converts to this type from the input type.
Source§

impl From<InvalidSync> for Error

Source§

fn from(source: InvalidSync) -> Self

Converts to this type from the input type.
Source§

impl From<OutputBufferTooSmall> for Error

Source§

fn from(source: OutputBufferTooSmall) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Error

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Error

Auto Trait Implementations§

§

impl Forget for Error

§

impl Freeze for Error
where &'static str: Freeze,

§

impl Move for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error
where &'static str: Send,

§

impl Sync for Error

§

impl Unpin for Error
where &'static str: Unpin,

§

impl UnsafeUnpin for Error
where &'static str: UnsafeUnpin,

§

impl UnwindSafe for Error
where &'static str: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.