pub struct DataUnit<'a> {
pub id: DataUnitId,
pub payload: DataUnitPayload<'a>,
}Expand description
One data unit: a data_unit_id, its data_unit_length, and the typed body
(ETSI EN 301 775 §4.4.1, Table 1 loop body).
Fields§
§id: DataUnitIddata_unit_id (Table 3).
payload: DataUnitPayload<'a>The typed body.
Implementations§
Source§impl<'a> DataUnit<'a>
impl<'a> DataUnit<'a>
Sourcepub fn data_unit_length(&self) -> usize
pub fn data_unit_length(&self) -> usize
data_unit_length: the number of body bytes after the length field.
Sourcepub fn serialized_len(&self) -> usize
pub fn serialized_len(&self) -> usize
Total wire size: data_unit_id (1) + data_unit_length (1) + body.
Sourcepub fn teletext(id: DataUnitId, field: TeletextDataField) -> Self
pub fn teletext(id: DataUnitId, field: TeletextDataField) -> Self
Build a Teletext data unit (EBU non-subtitle by default tag — supply the
id explicitly via DataUnit if a subtitle/inverted id is wanted).
Sourcepub fn vps(field: VpsDataField) -> Self
pub fn vps(field: VpsDataField) -> Self
Build a VPS data unit.
Sourcepub fn wss(field: WssDataField) -> Self
pub fn wss(field: WssDataField) -> Self
Build a WSS data unit.
Sourcepub fn closed_captioning(field: ClosedCaptioningDataField) -> Self
pub fn closed_captioning(field: ClosedCaptioningDataField) -> Self
Build a Closed Captioning data unit.
Sourcepub fn monochrome(field: MonochromeDataField<'a>) -> Self
pub fn monochrome(field: MonochromeDataField<'a>) -> Self
Build a monochrome 4:2:2 sample data unit.
Sourcepub fn parse(data: &'a [u8]) -> Result<(Self, usize)>
pub fn parse(data: &'a [u8]) -> Result<(Self, usize)>
Parse a single data unit from the start of data, returning it and the
number of bytes consumed.
Sourcepub fn serialize_into(&self, out: &mut [u8]) -> Result<usize>
pub fn serialize_into(&self, out: &mut [u8]) -> Result<usize>
Serialize the data unit into out, returning bytes written.
Trait Implementations§
impl<'a> Eq for DataUnit<'a>
impl<'a> StructuralPartialEq for DataUnit<'a>
Auto Trait Implementations§
impl<'a> Freeze for DataUnit<'a>
impl<'a> RefUnwindSafe for DataUnit<'a>
impl<'a> Send for DataUnit<'a>
impl<'a> Sync for DataUnit<'a>
impl<'a> Unpin for DataUnit<'a>
impl<'a> UnsafeUnpin for DataUnit<'a>
impl<'a> UnwindSafe for DataUnit<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more