Skip to main content

FetchObjectReader

Struct FetchObjectReader 

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

Resolves the elided fields of the frames on one FETCH stream.

Draft-17 Section 10.4.4.1, Table 8 defines every field a frame omits as the prior Object’s — a Group ID repeated, an Object ID stepped by one, a Priority carried over — and Table 7 does the same for the Subgroup ID, so no frame after the first can be understood on its own. This holds what the frames so far established, in the two parts the draft keeps separate: Section 10.4.4.2 says that after an End of Range marker the prior Group ID and Object ID are the marker’s, while the prior Subgroup ID and Priority are still “from the last actual Object before the End of Range indicator”.

Nothing here is a delta. The fields that are on the wire hold values rather than differences, which is what separates this from draft-18’s reader of the same name: draft-18 renamed both ID fields to deltas and gave them arithmetic, which is also why this reader needs no Group Order and draft-18’s does.

Implementations§

Source§

impl FetchObjectReader

Source

pub fn new() -> Self

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

Source

pub fn read_object_header( &mut self, buf: &mut impl Buf, ) -> Result<FetchObject, CodecError>

Decode the next frame’s header and resolve its fields.

Consumes the header only. The Object Payload is header.payload_length bytes and stays in buf, so a caller that forwards payloads never copies them and one that ignores them can skip.

Errors with CodecError::InvalidField when a frame names a field of a prior Object that does not exist — Section 10.4.4.1: “If the first Object in the FETCH response uses a flag that references fields in the prior Object, the Subscriber MUST close the session with a PROTOCOL_VIOLATION” — and when a Subgroup ID or Object ID one past the prior one would leave the 64-bit range.

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, <T as TryFrom<U>>::Error>

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.