Struct BlockReconstructor

Source
pub struct BlockReconstructor<F> { /* private fields */ }
Expand description

Tool for reconstructing block-wise messages.

This mechanism was designed so that it can be used successfully with block1 (request payload) and block2 (response payload) messages.

Implementations§

Source§

impl<F> BlockReconstructor<F>
where F: Write,

Source

pub fn new(write: F, next_block: BlockInfo) -> BlockReconstructor<F>

Creates a new instance of BlockReconstructor.

Source

pub fn next_block(&self) -> BlockInfo

The next block this object wants.

Source

pub fn is_finished(&self) -> bool

Returns true if we have received all of our blocks and have no additional processing to perform.

Source

pub fn into_inner(self) -> F

Consumes this object and returns the underlying std::io::Write instance.

Source

pub fn feed(&mut self, block: BlockInfo, payload: &[u8]) -> Result<bool, ()>

Feeds a block (with an associated payload) to the reconstructor.

Trait Implementations§

Source§

impl<F: Debug> Debug for BlockReconstructor<F>

Source§

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

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

impl<F: Default + Write> Default for BlockReconstructor<F>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<F> Freeze for BlockReconstructor<F>
where F: Freeze,

§

impl<F> RefUnwindSafe for BlockReconstructor<F>
where F: RefUnwindSafe,

§

impl<F> Send for BlockReconstructor<F>
where F: Send,

§

impl<F> Sync for BlockReconstructor<F>
where F: Sync,

§

impl<F> Unpin for BlockReconstructor<F>
where F: Unpin,

§

impl<F> UnwindSafe for BlockReconstructor<F>
where F: UnwindSafe,

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V