Skip to main content

FetchObjectReader

Struct FetchObjectReader 

Source
pub struct FetchObjectReader { /* private fields */ }
Expand description

Stateful resolver for the Objects on one draft-16 fetch stream.

Draft-16 Section 10.4.4.1 lets an Object leave its Group ID, Subgroup ID, Object ID or Priority off the wire and take the value from the Object before it, so the fields of a fetch object are only meaningful in stream order. This carries that running state; FetchObjectHeader carries only what the bytes said.

Unlike a subgroup stream, nothing here is a delta: a field that is on the wire replaces the running value outright, and a field that is absent either repeats it or steps it by one, as Table 5 and Table 6 say.

Implementations§

Source§

impl FetchObjectReader

Source

pub fn new() -> Self

A reader positioned before the first Object of a fetch stream, with no prior Object to inherit from.

Source

pub fn resolve( &mut self, header: &FetchObjectHeader, ) -> Result<FetchObjectLocation, CodecError>

Resolve one Object’s Location against the Object before it, advancing the running state.

Errors with CodecError::InvalidField when the first Object of the stream leaves out a Group ID or an Object ID, or names the prior Object’s Subgroup ID: draft-16 Section 10.4.4.1 makes a first Object that “uses a flag that references fields in the prior Object” a PROTOCOL_VIOLATION, and for these three fields there is no value to produce even if it were not. An absent Priority is the same violation by the draft’s letter and is reported by FetchObjectHeader::references_prior_object, but it is resolvable — the Location simply carries no priority — so it is not refused here.

Errors with CodecError::InvalidField when a Subgroup ID one greater than the prior Object’s would not fit a varint.

A FetchEndOfRange marker takes part in the running state like any other Object: Section 10.4.4.2 gives it a Location, and it is a “serialized Object” in the same section’s words, so the Object after it inherits its Group ID and steps from its Object ID.

Trait Implementations§

Source§

impl Clone for FetchObjectReader

Source§

fn clone(&self) -> FetchObjectReader

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 FetchObjectReader

Source§

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

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

impl Default for FetchObjectReader

Source§

fn default() -> FetchObjectReader

Returns the “default value” for a type. Read more

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.

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.