Skip to main content

ReadCursor

Struct ReadCursor 

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

Drives a stage over a sequential stream.

The cursor owns one window over the stream. It reads read_size bytes at a time (more when a request needs a larger contiguous span, up to max_window), offers the window, and drops what the stage took. Bytes the stage skips ahead over are read and discarded; a request behind the stream position is PumpFailure::NeedsRandomAccess.

Implementations§

Source§

impl ReadCursor

Source

pub fn new(read_size: usize, max_window: usize) -> Self

A cursor reading read_size bytes at a time (at least 512) and holding at most max_window contiguous bytes for one request.

Source

pub fn retained_input_capacity(&self) -> usize

Retained input allocation capacity, excluding the reader’s own buffers.

Source

pub fn next<S, R>( &mut self, reader: &mut R, stage: &mut S, pulse: Option<&dyn Pulse>, ) -> Result<Yield<S::Output>, PumpFailure<S::Error>>
where S: ByteStepper + ?Sized, R: Read + ?Sized,

Step stage over reader until it produces an output. Pass the same reader on every call.

Trait Implementations§

Source§

impl Debug for ReadCursor

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