Skip to main content

DataField

Struct DataField 

Source
pub struct DataField<'a> {
    pub data_identifier: u8,
    pub data_units: Vec<DataUnit<'a>>,
}
Expand description

The PES data field — ETSI EN 301 775 §4.4.1, Table 1.

A data_identifier (Table 2) followed by a sequence of DataUnits that fill the PES packet payload. parse walks the units until the buffer is exhausted; serialize_into emits them back-to-back.

Fields§

§data_identifier: u8

data_identifier (8 bits, Table 2): 0x100x1F or 0x990x9B for VBI; other values are reserved/user-defined (retained verbatim).

§data_units: Vec<DataUnit<'a>>

The data units carried in this PES data field.

Implementations§

Source§

impl<'a> DataField<'a>

Source

pub fn new(data_identifier: u8, data_units: Vec<DataUnit<'a>>) -> Self

Construct a data field from a data_identifier and its data units.

Source

pub fn serialized_len(&self) -> usize

Total wire size: 1 (data_identifier) + every data unit.

Source

pub fn parse(data: &'a [u8]) -> Result<Self>

Parse a PES data field from data: the data_identifier byte then a run of data units until the buffer is exhausted.

Source

pub fn serialize_into(&self, out: &mut [u8]) -> Result<usize>

Serialize the data field into out, returning bytes written.

Trait Implementations§

Source§

impl<'a> Clone for DataField<'a>

Source§

fn clone(&self) -> DataField<'a>

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<'a> Debug for DataField<'a>

Source§

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

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

impl<'a> Eq for DataField<'a>

Source§

impl<'a> PartialEq for DataField<'a>

Source§

fn eq(&self, other: &DataField<'a>) -> bool

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

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

Inequality operator !=. Read more
Source§

impl<'a> Serialize for DataField<'a>

Available on crate feature serde only.
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> StructuralPartialEq for DataField<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for DataField<'a>

§

impl<'a> RefUnwindSafe for DataField<'a>

§

impl<'a> Send for DataField<'a>

§

impl<'a> Sync for DataField<'a>

§

impl<'a> Unpin for DataField<'a>

§

impl<'a> UnsafeUnpin for DataField<'a>

§

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