Skip to main content

ReadAtCursor

Struct ReadAtCursor 

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

Drives a stage over a random-access source.

Sequential requests read forward into a driver-owned window (a short read marks the end of the source; ReadAt::len is called only when the stage asks for the length). Range requests are coalesced (DriveOptions::max_gap) and fetched with one read_many_at per round, so a concurrent source overlaps their round trips; later ranges of the same round are served from the fetched buffers. A source already in memory (ReadAt::as_slice) is driven without copying.

Implementations§

Source§

impl ReadAtCursor

Source

pub fn new(opts: DriveOptions) -> Self

A cursor with the given read sizes.

Source

pub fn stats(&self) -> DriveStats

Steps, reads and bytes read so far.

Source

pub fn retained_input_capacity(&self) -> usize

Retained driver-owned payload capacity; borrowed source bytes are excluded.

Source

pub fn next<S, Src>( &mut self, source: &mut Src, stage: &mut S, pulse: Option<&dyn Pulse>, ) -> Result<Yield<<S as ByteStepper>::Output>, DriveFailure<<S as ByteStepper>::Error, Src::Error>>
where S: ByteStepper + ?Sized, Src: ReadAt + ?Sized,

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

Trait Implementations§

Source§

impl Debug for ReadAtCursor

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.