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-17 subgroup stream. Object IDs are
delta-encoded and the presence of a “properties” block (the
draft-17 equivalent of extension headers) is determined by the
PROPERTIES bit on the enclosing SubgroupHeader. Use
SubgroupObjectReader to encode/decode.
Fields§
§object_id: VarInt§extension_headers: Vec<u8>Raw properties bytes, excluding the byte-length prefix that precedes
them on the wire. Empty unless the subgroup header sets the
PROPERTIES 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§object_status: Option<ObjectStatus>The object’s status, carried on the wire only when payload_length is
zero: a zero-length object encodes a status code in place of its
payload. None with a zero payload_length is written as
ObjectStatus::Normal, the status draft-17 Section 10.2.1.1 gives an
empty object.
Typed rather than a raw code. The wire field is a varint with room for
any value, and draft-17 assigns three of them; the decoder refuses the
rest, and this type is that same refusal on the encode side — 0x1 and
0x2 cannot be named here, so SubgroupObjectReader::write_object
cannot emit a status this module’s own decoder would reject.
payload: Vec<u8>Implementations§
Source§impl SubgroupObject
impl SubgroupObject
Sourcepub fn status(&self) -> ObjectStatus
pub fn status(&self) -> ObjectStatus
The object’s status, with the one draft-17’s encoding elides filled in.
A subgroup object states its status only when its Object Payload Length
is zero. An object that carries bytes therefore has no status field, and
its status is ObjectStatus::Normal — the only status draft-17
Section 10.2.1.1 permits a payload, so the only one such an object could
have had.
Sourcepub fn properties_permitted(&self) -> bool
pub fn properties_permitted(&self) -> bool
Whether this object’s status is allowed to carry the properties it has.
Draft-17 Section 10.2.1.2: “Any Object with status Normal can have properties (Section 2.5). If an endpoint receives properties on an Object 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 properties block
on an object whose status is not ObjectStatus::Normal. An object
with no properties is fine at any status, and an object at Normal may
carry any properties. A zero-length block is “no properties” here and
not a violation — Section 10.4.2 requires it of an object on a
PROPERTIES subgroup stream that has none: “Objects with no properties
set Properties Length to 0.”
SubgroupObjectReader::read_object and
SubgroupObjectReader::write_object refuse an object this answers
false for; SubgroupObjectReader::read_object_meta frames it.