Skip to main content

StreamType

Enum StreamType 

Source
#[repr(u64)]
pub enum StreamType {
Show 13 variants Fetch = 5, SubgroupZero = 16, SubgroupZeroExt = 17, SubgroupFirstObj = 18, SubgroupFirstObjExt = 19, SubgroupExplicit = 20, SubgroupExplicitExt = 21, SubgroupZeroEog = 24, SubgroupZeroEogExt = 25, SubgroupFirstObjEog = 26, SubgroupFirstObjEogExt = 27, SubgroupExplicitEog = 28, SubgroupExplicitEogExt = 29,
}
Expand description

Stream type IDs for draft-12 data streams.

§Draft-12 contradicts itself about where the subgroup types sit

Three places in this draft name the SUBGROUP_HEADER Type range, and they do not agree. Two of them carry draft-11’s answer:

  • Section 9, Table 10, the table of unidirectional stream types, whose SUBGROUP_HEADER row reads 0x08-0x0D.
  • Section 9.4.2, Figure 35, the header’s own layout: Type (i) = 0x8..0xD.

The third does not. Section 9.4.2 says “There are 12 defined Type values for SUBGROUP_HEADER” and Table 13, immediately under that figure, lists them: 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x18, 0x19, 0x1A, 0x1B, 0x1C and 0x1D.

This enum implements Table 13, so a stream opening with 0x08 through 0x0D is CodecError::UnknownStreamType and closes the session.

Table 13 is the surviving half, for the same reason and by the same mechanism as the datagram-status contradiction documented on DatagramType — a code-point update that missed a spot:

  • The range 0x08-0x0D holds six values, and this draft defines twelve types. Draft-11 Section 9.4.2 Table 11 lists exactly six, at 0x08 through 0x0D, and the twelve here are those six crossed with the End Of Group bit draft-12 added — its own change log says so: “Use bits in SUBGROUP_HEADER and DATAGRAM* types to compress subgroup ID and extensions”. So 0x08-0x0D and 0x8..0xD are draft-11’s range left behind, and they cannot hold what this draft defines.
  • Table 13 is the only one of the three that says what each value means. The other two give a range and nothing else, so following either would leave every framing decision — whether a Subgroup ID field is on the wire, whether objects carry extensions, whether the stream ends the group — with nothing to read it from.
  • Draft-14 keeps Table 13 unchanged and corrects the other two to match: its Table 10 reads “0x10-0x1D” and its Figure reads Type (i) = 0x10..0x1D. That is the disagreement being resolved in favour of Table 13 by the working group, one draft later.

Draft-13 repeats all three halves unchanged, and carries the same note.

The cost of being wrong is asymmetric and points the same way. Accepting 0x08-0x0D as well would mean parsing a stream under framing no table assigns it, which is the failure this codebase refuses elsewhere — an out-of-range Type aliased onto a valid one produces objects with plausible, wrong contents. Refusing them closes a session with a peer that followed the stale half of its own draft, which is visible, reportable, and what draft-14 says the peer should not have done.

Variants§

§

Fetch = 5

Fetch response stream (0x05).

§

SubgroupZero = 16

Subgroup: subgroup_id=0, no extensions (0x10).

§

SubgroupZeroExt = 17

Subgroup: subgroup_id=0, with extensions (0x11).

§

SubgroupFirstObj = 18

Subgroup: subgroup_id=first object ID, no extensions (0x12).

§

SubgroupFirstObjExt = 19

Subgroup: subgroup_id=first object ID, with extensions (0x13).

§

SubgroupExplicit = 20

Subgroup: explicit subgroup_id, no extensions (0x14).

§

SubgroupExplicitExt = 21

Subgroup: explicit subgroup_id, with extensions (0x15).

§

SubgroupZeroEog = 24

Subgroup: subgroup_id=0, contains end of group, no extensions (0x18).

§

SubgroupZeroEogExt = 25

Subgroup: subgroup_id=0, contains end of group, with extensions (0x19).

§

SubgroupFirstObjEog = 26

Subgroup: subgroup_id=first object ID, contains end of group, no extensions (0x1A).

§

SubgroupFirstObjEogExt = 27

Subgroup: subgroup_id=first object ID, contains end of group, with extensions (0x1B).

§

SubgroupExplicitEog = 28

Subgroup: explicit subgroup_id, contains end of group, no extensions (0x1C).

§

SubgroupExplicitEogExt = 29

Subgroup: explicit subgroup_id, contains end of group, with extensions (0x1D).

Implementations§

Source§

impl StreamType

Source

pub fn from_id(id: u64) -> Option<Self>

Source

pub fn is_subgroup(&self) -> bool

Source

pub fn has_extensions(&self) -> bool

Source

pub fn contains_end_of_group(&self) -> bool

True if this subgroup stream type indicates the stream contains the end of its group.

Source

pub fn writes_subgroup_id(&self) -> bool

True if this subgroup stream type puts an explicit Subgroup ID on the wire.

The Subgroup ID Field Present column of the SUBGROUP_HEADER type table in Section 9.4.2. The other two columns of that row say what the Subgroup ID is where the field is absent — zero, or the first Object’s ID — so this is only about the field, never about the value.

Trait Implementations§

Source§

impl Clone for StreamType

Source§

fn clone(&self) -> Self

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 Copy for StreamType

Source§

impl Debug for StreamType

Source§

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

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

impl Eq for StreamType

Source§

impl PartialEq for StreamType

Source§

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

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.