Struct vortex_io::VortexBufReader
source · pub struct VortexBufReader<R> { /* private fields */ }
Expand description
A stateful asynchronous reader that wraps an internal stateless reader.
Read operations will advance the cursor.
Implementations§
source§impl<R> VortexBufReader<R>
impl<R> VortexBufReader<R>
sourcepub fn new(inner: R) -> Self
pub fn new(inner: R) -> Self
Create a new buffered reader wrapping a stateless reader, with reads beginning at offset 0.
sourcepub fn set_position(&mut self, pos: u64)
pub fn set_position(&mut self, pos: u64)
Set the position of the next read_bytes
call directly.
Note: this method will not fail if the position is past the end of the valid range,
the failure will occur at read time and result in an UnexpectedEof
error.
source§impl<R: VortexReadAt> VortexBufReader<R>
impl<R: VortexReadAt> VortexBufReader<R>
sourcepub async fn read_bytes(&mut self, len: u64) -> Result<Buffer>
pub async fn read_bytes(&mut self, len: u64) -> Result<Buffer>
Perform an exactly-sized read at the current cursor position, advancing the cursor and returning the bytes.
If there are not enough bytes available to fulfill the request, an
UnexpectedEof
error is returned.
See also VortexReadAt::read_byte_range
.
Trait Implementations§
source§impl<R: Clone> Clone for VortexBufReader<R>
impl<R: Clone> Clone for VortexBufReader<R>
source§fn clone(&self) -> VortexBufReader<R>
fn clone(&self) -> VortexBufReader<R>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<R> Freeze for VortexBufReader<R>where
R: Freeze,
impl<R> RefUnwindSafe for VortexBufReader<R>where
R: RefUnwindSafe,
impl<R> Send for VortexBufReader<R>where
R: Send,
impl<R> Sync for VortexBufReader<R>where
R: Sync,
impl<R> Unpin for VortexBufReader<R>where
R: Unpin,
impl<R> UnwindSafe for VortexBufReader<R>where
R: UnwindSafe,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more