Skip to main content

SubgroupHeader

Struct SubgroupHeader 

Source
pub struct SubgroupHeader {
    pub stream_type: SubgroupStreamType,
    pub track_alias: VarInt,
    pub group_id: VarInt,
    pub subgroup_id: Option<VarInt>,
    pub publisher_priority: u8,
}
Expand description

Subgroup stream header.

Wire order: type byte, Track Alias, Group ID, Subgroup ID (only for stream types that carry one), Publisher Priority.

Fields§

§stream_type: SubgroupStreamType

Type byte identifying the flag set for this stream.

§track_alias: VarInt

Track alias.

§group_id: VarInt

Group ID.

§subgroup_id: Option<VarInt>

Explicit Subgroup ID — present only when the stream type sets Subgroup ID Field Present = Yes. For types where the subgroup ID is implicit (0 or the first Object ID), the effective subgroup ID is resolved on the receive side by the reader.

§publisher_priority: u8

Publisher priority.

Implementations§

Source§

impl SubgroupHeader

Source

pub fn encode(&self, buf: &mut impl BufMut)

Encode the header including the leading stream type byte.

Driven by stream_type, and silent about a subgroup_id that disagrees with it in either direction: a None under a type whose Subgroup ID Field Present column reads Yes is written as zero, which names a different subgroup rather than no subgroup, and a Some under a type whose column reads No is dropped. Both write a well-formed stream describing something other than what the caller built. Self::encode_checked refuses that shape instead.

Source

pub fn encode_checked(&self, buf: &mut impl BufMut) -> Result<(), CodecError>

Encode, refusing a header whose Subgroup ID disagrees with its own type byte.

Section 10.4.2 gives the SUBGROUP_HEADER type table a Subgroup ID Field Present column, and that column - not the value in hand - decides whether the field is on the wire. Self::decode therefore only ever produces a header where the two agree, so this refuses exactly the shapes a caller assembled by hand: an absent ID under a type that carries one, and a present ID under a type that does not.

Nothing about the value is refused. Zero is a legal Subgroup ID, so a Some(0) under a type that carries the field is written as the caller asked.

§Errors

CodecError::InvalidField if the presence of subgroup_id does not match what stream_type puts on the wire.

Source

pub fn decode(buf: &mut impl Buf) -> Result<Self, CodecError>

Decode a subgroup header (leading type byte + remaining fields).

Errors with CodecError::UnknownStreamType when the stream table does not assign the leading type, which this draft answers with a close, and with CodecError::InvalidField for 0x05, which it assigns to a fetch stream. stream_type_error draws that line.

Trait Implementations§

Source§

impl Clone for SubgroupHeader

Source§

fn clone(&self) -> SubgroupHeader

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 SubgroupHeader

Source§

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

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

impl Eq for SubgroupHeader

Source§

impl PartialEq for SubgroupHeader

Source§

fn eq(&self, other: &SubgroupHeader) -> 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 SubgroupHeader

Auto Trait Implementations§

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 = !

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.