Skip to main content

SubgroupObject

Struct SubgroupObject 

Source
pub struct SubgroupObject {
    pub object_id: VarInt,
    pub extension_headers: Vec<u8>,
    pub payload_length: VarInt,
    pub object_status: Option<ObjectStatus>,
    pub payload: Vec<u8>,
}
Expand description

One object within a draft-15 subgroup stream with its Object ID already resolved from the delta encoding.

Draft-15 object framing requires context from the enclosing SubgroupHeader (specifically, whether extension headers are present and the running delta state), so decoding/encoding uses a stateful SubgroupObjectReader rather than a standalone method.

Fields§

§object_id: VarInt

Resolved absolute Object ID.

§extension_headers: Vec<u8>

Raw extension-header bytes, excluding the byte-length prefix that precedes them on the wire. Empty when the stream header does not set the extensions-present bit, or when the block is present but zero-length. Opaque: SubgroupObjectReader::write_object re-emits the prefix and these bytes verbatim.

§payload_length: VarInt

Payload length as encoded on the wire. Zero when the object is a status-only object.

§object_status: Option<ObjectStatus>

Object status; Some when payload_length == 0.

The wire field is a varint, so it can carry any value up to 2^62-1; draft-15 Section 10.2.1.1 assigns four of them and says a peer SHOULD treat the rest as a protocol error. This field is typed to the assigned set, so it refuses to hold the codes the draft leaves unassigned — 0x2, and everything from 0x5 up. That makes the refusal a property of the struct rather than of any one code path: an encoder cannot be handed a status the draft does not define, and does not have to check.

None on a zero-length object means the same thing as ObjectStatus::Normal and encodes as it; the wire field is not optional once payload_length is zero.

§payload: Vec<u8>

Payload bytes; empty when object_status is Some.

Implementations§

Source§

impl SubgroupObject

Source

pub fn status(&self) -> ObjectStatus

The status this object resolves to.

The wire carries a status field only on a zero-length object, so an object holding bytes is ObjectStatus::Normal whatever Self::object_status says — draft-15 Section 10.2.1.1: “This status is implicit for any non-zero length object.”

Source

pub fn extensions_permitted(&self) -> bool

Whether this object’s status is allowed to carry the extension headers it has.

Draft-15 Section 10.2.1.2: “Any Object with status Normal can have extension headers. If an endpoint receives extension headers on Objects with status that is not Normal, it MUST close the session with a PROTOCOL_VIOLATION.”

So this is false for exactly one shape: a non-empty extension block on an object whose status is not ObjectStatus::Normal. An object with no extensions is fine at any status, and an object at Normal may carry any extensions.

Neither SubgroupObjectReader::read_object nor SubgroupObjectReader::write_object applies this itself, which is a deliberate contrast with the payload rule beside it. A status next to a payload has no encoding — the two share a position on the wire — so the writer refuses it as unrepresentable. Extensions next to a status encode fine; the frame is well formed and merely non-conforming, and a codec that could not read or write it could not reproduce a capture containing one. The corpus ships exactly such a frame. The rule addresses an endpoint receiving the Object, so the endpoint is where it is enforced, and this is what it asks.

Trait Implementations§

Source§

impl Clone for SubgroupObject

Source§

fn clone(&self) -> SubgroupObject

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 SubgroupObject

Source§

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

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

impl Eq for SubgroupObject

Source§

impl PartialEq for SubgroupObject

Source§

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

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, <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.