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-16 subgroup stream with its Object ID
already resolved from the delta encoding. See
SubgroupObjectReader for stateful encode/decode.
Fields§
§object_id: VarInt§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§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-16 Section 10.2.1.1 assigns three 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 — including 0x1, Object Does Not Exist, which drafts 07-15 assign and draft-16 dropped. 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>Implementations§
Source§impl SubgroupObject
impl SubgroupObject
Sourcepub fn status(&self) -> ObjectStatus
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-16 Section 10.2.1.1: “This status is
implicit for any non-zero length object.”
Sourcepub fn extensions_permitted(&self) -> bool
pub fn extensions_permitted(&self) -> bool
Whether this Object’s status is allowed to carry the extension headers it has.
false for exactly one shape: a non-empty extension block on an Object
whose status is not ObjectStatus::Normal. See
extensions_permitted_at for the rule and for why neither
SubgroupObjectReader::read_object nor
SubgroupObjectReader::write_object applies it — this is the codec’s
way of reporting the violation to the endpoint that must act on it,
rather than refusing bytes that are well formed.