Skip to main content

AnyFetchObject

Struct AnyFetchObject 

Source
pub struct AnyFetchObject {
    pub group_id: u64,
    pub subgroup_id: Option<u64>,
    pub object_id: u64,
    pub payload: Vec<u8>,
    pub status: Option<u64>,
    pub end_of_range: Option<u64>,
}
Expand description

One object on a fetch stream, in the terms every draft shares.

AnyObject’s twin, and it needs three fields that one does not, because a fetch stream is not a subgroup stream with a different header on it. A subgroup stream’s header names the Group and the Subgroup once and every object on it belongs to them; a fetch stream carries a whole range, so each object states its own Location — and from draft-15 it states it by inheritance, leaving fields off the wire that the object before it supplies. Every value here is resolved: what a caller gets is where the object is, never what the wire happened to write down.

Fields§

§group_id: u64

The Group this object belongs to, resolved.

§subgroup_id: Option<u64>

The Subgroup, resolved, and None where the draft lets an object on a fetch stream have none.

Drafts 07 through 15 always carry it. From draft-16 an object whose Forwarding Preference is Datagram omits it — draft-16 Section 10.2.1 — and so does an end-of-range marker, which is a span rather than an object.

§object_id: u64

The Object ID, resolved. Drafts 15 and later may encode it as a step from the object before it on the stream, and the reader has undone that.

§payload: Vec<u8>

The payload. Empty when status is Some, and empty on every end-of-range marker.

§status: Option<u64>

The Object Status wire code, on the same terms as AnyObject::status: Some exactly when the object carried no payload, because the two occupy the same position on the wire.

Always None from draft-16 on, and that is the drafts talking rather than this type giving up: draft-16 deleted the Object Status field from a fetch object and put Self::end_of_range in its place. The pair covers one question between them — is this an object, or a statement about objects that are not here — and which of the two answers it depends on the draft.

§end_of_range: Option<u64>

The end-of-range marker’s own wire code, where this “object” is one.

Drafts 16 through 20 end a fetch that cannot serve part of its range with a marker rather than with silence, and the marker covers the whole span from the last serialized object to this Location inclusive: 0x8C for a span known not to exist, 0x10C for one whose status is unknown, and draft-20 adds 0x20C for one the publisher abandoned.

A number rather than an enum for the reason crate::dispatch’s neighbours are: the code is the fingerprint, and a fifteenth draft assigning a fourth marker should widen a report rather than fail to parse. None on drafts 07 through 15, which have no such marker — there the same news arrives, when it arrives at all, as a Self::status.

Trait Implementations§

Source§

impl Clone for AnyFetchObject

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 AnyFetchObject

Source§

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

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

impl Eq for AnyFetchObject

Source§

impl PartialEq for AnyFetchObject

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 AnyFetchObject

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