pub struct AnyObject {
pub object_id: u64,
pub payload: Vec<u8>,
pub status: Option<u64>,
}Expand description
One object on a subgroup stream, in the terms every draft shares.
The drafts give a subgroup object five different struct shapes, and
what varies between them is bookkeeping rather than content: whether the
extension block is counted or measured, whether the status is a field that
is always present or an Option, whether the declared length is stored
beside the payload or derived from it. None of that is a choice a caller
makes. What a caller has is an ID and some bytes.
The extension block is absent here for a different reason than the rest. It
is a property of the stream, not of the object — the header settles it
once, and an object with nothing to put in the block still writes a length
of zero on a stream that carries one, which is why
moqtap_codec::dispatch::AnySubgroupHeader::carries_extension_block is
asked of the header. AnyConnection::open_subgroup opens streams that
carry none wherever a draft has a way to say so — eleven of the drafts;
AnyConnection::accept_subgroup reads whichever kind the peer opened, and
hands the header over so a caller can ask.
Fields§
§object_id: u64The Object ID, resolved.
Drafts 14 and later encode it as a delta against the object before it on the same stream. The per-draft reader has already undone that, so this is the absolute ID on every draft and a caller never sees the encoding.
payload: Vec<u8>The payload. Empty when status is Some.
status: Option<u64>The Object Status wire code, or None when the object carried a payload
instead.
None means the same thing on all the drafts, which is why this is
an Option even though half of them model the status as a field that is
always there. Every draft writes the status only when the declared
payload length is zero, because the status and the payload occupy the
same position on the wire: no sequence of bytes states both. So the
question “did this object carry a status?” has one answer per object,
and it is the answer the wire gives rather than the one a particular
draft’s struct happens to hold.