Skip to main content

AnyObject

Struct AnyObject 

Source
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: u64

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

Trait Implementations§

Source§

impl Clone for AnyObject

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 Debug for AnyObject

Source§

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

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

impl Eq for AnyObject

Source§

impl PartialEq for AnyObject

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 AnyObject

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more