Skip to main content

LocalSet

Struct LocalSet 

Source
pub struct LocalSet<'a> {
    pub key: UlBytes,
    pub items: Vec<LocalSetItem<'a>>,
}
Expand description

A Header Metadata Set encoded with MXF’s “local set” framing (§9.3): a 16-byte Set Key identifying which Set this is (see StructuralSetKind), a BER Length, and a sequence of LocalSetItems.

Fields§

§key: UlBytes

The Set Key (all 16 bytes, as found on the wire).

§items: Vec<LocalSetItem<'a>>

The Set’s items, in on-wire order.

Implementations§

Source§

impl<'a> LocalSet<'a>

Source

pub fn kind(&self) -> StructuralSetKind

This Set’s Kind (Table 17), from its Key’s bytes 14/15.

Source

pub fn item_length_mode(&self) -> ItemLengthMode

This Set’s item length mode (Table 16 byte 6).

key is a public field (callers can build a LocalSet directly, not only via LocalSet::parse_prefix), so this cannot assume byte 6 is one of the two valid values — falls back to ItemLengthMode::TwoByte (the spec’s own documented default) rather than panicking on a self-constructed LocalSet with an invalid key.

Source

pub fn get(&self, tag: u16) -> Option<&'a [u8]>

The first item with local tag tag, if any.

Source

pub fn build_key(kind: StructuralSetKind, mode: ItemLengthMode) -> UlBytes

Build a fresh Local Set Key for kind, using mode for the item length encoding and registry version 0x01.

Source

pub fn parse_prefix(bytes: &'a [u8]) -> Result<(Self, usize)>

Parse one Local Set (Key + BER Length + items) from the start of bytes, returning it with the total bytes consumed — use this to walk a sequence of Header Metadata Sets in a stream.

Trait Implementations§

Source§

impl<'a> Clone for LocalSet<'a>

Source§

fn clone(&self) -> LocalSet<'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 LocalSet<'a>

Source§

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

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

impl<'a> Eq for LocalSet<'a>

Source§

impl<'a> Parse<'a> for LocalSet<'a>

Source§

type Error = Error

The error type this implementer returns. Typically the enclosing crate’s Error enum.
Source§

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

Parse bytes as Self. Returns Err(Self::Error) on any protocol violation or buffer underrun.
Source§

impl<'a> PartialEq for LocalSet<'a>

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Serialize for LocalSet<'_>

Source§

type Error = Error

The error type this implementer returns (usually the same as the corresponding Parse impl, but need not be).
Source§

fn serialized_len(&self) -> usize

Number of bytes serialize_into will write.
Source§

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

Write the serialised form into buf. Returns the number of bytes written (always equal to serialized_len()).
Source§

fn to_bytes(&self) -> Vec<u8>
where Self::Error: Debug,

Convenience: allocate a Vec and serialise into it. Read more
Source§

impl<'a> StructuralPartialEq for LocalSet<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for LocalSet<'a>

§

impl<'a> RefUnwindSafe for LocalSet<'a>

§

impl<'a> Send for LocalSet<'a>

§

impl<'a> Sync for LocalSet<'a>

§

impl<'a> Unpin for LocalSet<'a>

§

impl<'a> UnsafeUnpin for LocalSet<'a>

§

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