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: SubgroupStreamTypeType byte identifying the flag set for this stream.
track_alias: VarIntTrack alias.
group_id: VarIntGroup 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: u8Publisher priority.
Implementations§
Source§impl SubgroupHeader
impl SubgroupHeader
Sourcepub fn encode(&self, buf: &mut impl BufMut)
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.
Sourcepub fn encode_checked(&self, buf: &mut impl BufMut) -> Result<(), CodecError>
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.
Sourcepub fn decode(buf: &mut impl Buf) -> Result<Self, CodecError>
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
impl Clone for SubgroupHeader
Source§fn clone(&self) -> SubgroupHeader
fn clone(&self) -> SubgroupHeader
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more