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
impl ReadAtCursor
Sourcepub fn new(opts: DriveOptions) -> Self
pub fn new(opts: DriveOptions) -> Self
A cursor with the given read sizes.
Sourcepub fn stats(&self) -> DriveStats
pub fn stats(&self) -> DriveStats
Steps, reads and bytes read so far.
Sourcepub fn retained_input_capacity(&self) -> usize
pub fn retained_input_capacity(&self) -> usize
Retained driver-owned payload capacity; borrowed source bytes are excluded.
Sourcepub 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>>
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>>
Step stage over source until it produces an output. Pass the same
source on every call.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ReadAtCursor
impl RefUnwindSafe for ReadAtCursor
impl Send for ReadAtCursor
impl Sync for ReadAtCursor
impl Unpin for ReadAtCursor
impl UnsafeUnpin for ReadAtCursor
impl UnwindSafe for ReadAtCursor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more