Skip to main content

FetchObjectWriter

Struct FetchObjectWriter 

Source
pub struct FetchObjectWriter {
    group_order: GroupOrder,
    prior_location: Option<(u64, u64)>,
    prior_subgroup_id: Option<u64>,
    prior_publisher_priority: Option<u8>,
}
Expand description

Re-encodes resolved fetch entries onto one FETCH stream.

The inverse of FetchObjectReader, for a caller writing a different stream from the entries it read: removing an entry changes what the ones after it are encoded against. The entry’s own header is the preference; wherever its shape still encodes the same meaning against the new predecessor it is kept, so a stream with nothing removed is reproduced byte for byte.

CodecError::InvalidField where no encoding exists: a Group ID that moves against the Group Order, an Object ID that does not advance, an Object with neither a Subgroup ID nor the Datagram bit, an End of Group or End of Track whose Object is not the one written before it, and the arithmetic overflows.

Fields§

§group_order: GroupOrder§prior_location: Option<(u64, u64)>

Group ID and Object ID the next entry is encoded against.

§prior_subgroup_id: Option<u64>

Subgroup ID of the last actual Object written that had one.

§prior_publisher_priority: Option<u8>

Publisher Priority of the last actual Object written.

Implementations§

Source§

impl FetchObjectWriter

Source

pub fn new(group_order: GroupOrder) -> Self

A writer for a stream whose Groups are being written in group_order, which has to be the order the FETCH was opened with.

Source

pub fn header_for( &self, frame: &FetchObject, ) -> Result<FetchObjectHeader, CodecError>

The header that encodes frame against everything written so far. Does not advance the writer.

Source

fn range_fields( &self, frame: &FetchObject, ) -> Result<(VarInt, VarInt), CodecError>

An End of Range indicator’s two fields against this predecessor, Section 11.4.2.1.

Source

fn identity_fields( &self, frame: &FetchObject, original: &FetchObjectHeader, ) -> Result<(Option<VarInt>, Option<VarInt>), CodecError>

An Object’s Group ID Delta and Object ID Delta fields against this predecessor, Section 11.4.1.1.

Source

fn subgroup_field( &self, frame: &FetchObject, original: &FetchObjectHeader, ) -> Result<(u64, Option<VarInt>), CodecError>

The Subgroup ID mode bits and the explicit field, if one is needed. The frame’s own mode is tried first.

Source

fn priority_field( &self, frame: &FetchObject, original: &FetchObjectHeader, ) -> Result<Option<u8>, CodecError>

The Publisher Priority field, or None when the predecessor already carries it.

Source

pub fn write_object_header( &mut self, frame: &FetchObject, out: &mut impl BufMut, ) -> Result<FetchObjectHeader, CodecError>

Encode frame against everything written so far and advance. Writes the header only; the writer is left untouched on an error.

Source

pub fn advance(&mut self, frame: &FetchObject)

Record frame as the predecessor of whatever is written next.

Trait Implementations§

Source§

impl Clone for FetchObjectWriter

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 FetchObjectWriter

Source§

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

Formats the value using the given formatter. 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.