pub struct BStackSliceReader<'a, A: BStackAllocator> { /* private fields */ }Expand description
A cursor-based reader over a BStackSlice.
Implements io::Read and io::Seek within the coordinate space of the
slice — position 0 maps to slice.offset in the underlying payload, and
the reader cannot read past slice.offset + slice.len.
Constructed via BStackSlice::reader or BStackSlice::reader_at.
Implementations§
Source§impl<'a, A: BStackAllocator> BStackSliceReader<'a, A>
impl<'a, A: BStackAllocator> BStackSliceReader<'a, A>
Sourcepub fn position(&self) -> u64
pub fn position(&self) -> u64
Return the current cursor position within the slice (not the payload).
Sourcepub fn slice(&self) -> BStackSlice<'a, A>
pub fn slice(&self) -> BStackSlice<'a, A>
Return the underlying BStackSlice.
Trait Implementations§
Source§impl<'a, A: BStackAllocator> Clone for BStackSliceReader<'a, A>
impl<'a, A: BStackAllocator> Clone for BStackSliceReader<'a, A>
Source§impl<'a, A: BStackAllocator> Debug for BStackSliceReader<'a, A>
impl<'a, A: BStackAllocator> Debug for BStackSliceReader<'a, A>
Source§impl<'a, A: BStackAllocator> From<BStackSlice<'a, A>> for BStackSliceReader<'a, A>
Convert a slice into a reader positioned at the start.
impl<'a, A: BStackAllocator> From<BStackSlice<'a, A>> for BStackSliceReader<'a, A>
Convert a slice into a reader positioned at the start.
Equivalent to BStackSlice::reader.
Source§fn from(slice: BStackSlice<'a, A>) -> Self
fn from(slice: BStackSlice<'a, A>) -> Self
Source§impl<'a, A: BStackAllocator> From<BStackSliceReader<'a, A>> for BStackSlice<'a, A>
Convert a reader back into its underlying slice, discarding the cursor.
impl<'a, A: BStackAllocator> From<BStackSliceReader<'a, A>> for BStackSlice<'a, A>
Convert a reader back into its underlying slice, discarding the cursor.
Equivalent to BStackSliceReader::slice.
Source§fn from(reader: BStackSliceReader<'a, A>) -> Self
fn from(reader: BStackSliceReader<'a, A>) -> Self
Source§impl<'a, A: BStackAllocator> From<BStackSliceReader<'a, A>> for BStackSliceWriter<'a, A>
Available on crate feature set only.Convert a reader into a writer at the same position.
impl<'a, A: BStackAllocator> From<BStackSliceReader<'a, A>> for BStackSliceWriter<'a, A>
set only.Convert a reader into a writer at the same position.
The reader and writer share the same underlying slice and cursor position.
Source§fn from(reader: BStackSliceReader<'a, A>) -> Self
fn from(reader: BStackSliceReader<'a, A>) -> Self
Source§impl<'a, A: BStackAllocator> From<BStackSliceWriter<'a, A>> for BStackSliceReader<'a, A>
Available on crate feature set only.Convert a writer into a reader at the same position.
impl<'a, A: BStackAllocator> From<BStackSliceWriter<'a, A>> for BStackSliceReader<'a, A>
set only.Convert a writer into a reader at the same position.
The reader and writer share the same underlying slice and cursor position.
Source§fn from(writer: BStackSliceWriter<'a, A>) -> Self
fn from(writer: BStackSliceWriter<'a, A>) -> Self
Source§impl<'a, A: BStackAllocator> Hash for BStackSliceReader<'a, A>
impl<'a, A: BStackAllocator> Hash for BStackSliceReader<'a, A>
Source§impl<'a, A: BStackAllocator> Ord for BStackSliceReader<'a, A>
Readers are ordered by absolute payload position (slice.start() + cursor),
then by slice length.
impl<'a, A: BStackAllocator> Ord for BStackSliceReader<'a, A>
Readers are ordered by absolute payload position (slice.start() + cursor),
then by slice length.
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<'a, A: BStackAllocator> PartialEq<BStackSlice<'a, A>> for BStackSliceReader<'a, A>
impl<'a, A: BStackAllocator> PartialEq<BStackSlice<'a, A>> for BStackSliceReader<'a, A>
Source§fn eq(&self, other: &BStackSlice<'a, A>) -> bool
fn eq(&self, other: &BStackSlice<'a, A>) -> bool
self and other values to be equal, and is used by ==.Source§impl<'a, A: BStackAllocator> PartialEq<BStackSliceReader<'a, A>> for BStackSlice<'a, A>
impl<'a, A: BStackAllocator> PartialEq<BStackSliceReader<'a, A>> for BStackSlice<'a, A>
Source§fn eq(&self, other: &BStackSliceReader<'a, A>) -> bool
fn eq(&self, other: &BStackSliceReader<'a, A>) -> bool
self and other values to be equal, and is used by ==.Source§impl<'a, A: BStackAllocator> PartialEq<BStackSliceReader<'a, A>> for BStackSliceWriter<'a, A>
Available on crate feature set only.
impl<'a, A: BStackAllocator> PartialEq<BStackSliceReader<'a, A>> for BStackSliceWriter<'a, A>
set only.Source§fn eq(&self, other: &BStackSliceReader<'a, A>) -> bool
fn eq(&self, other: &BStackSliceReader<'a, A>) -> bool
self and other values to be equal, and is used by ==.Source§impl<'a, A: BStackAllocator> PartialEq<BStackSliceWriter<'a, A>> for BStackSliceReader<'a, A>
Available on crate feature set only.
impl<'a, A: BStackAllocator> PartialEq<BStackSliceWriter<'a, A>> for BStackSliceReader<'a, A>
set only.Source§fn eq(&self, other: &BStackSliceWriter<'a, A>) -> bool
fn eq(&self, other: &BStackSliceWriter<'a, A>) -> bool
self and other values to be equal, and is used by ==.Source§impl<'a, A: BStackAllocator> PartialEq for BStackSliceReader<'a, A>
Two readers are equal when they wrap equal slices and share the same cursor.
impl<'a, A: BStackAllocator> PartialEq for BStackSliceReader<'a, A>
Two readers are equal when they wrap equal slices and share the same cursor.
Source§impl<'a, A: BStackAllocator> PartialOrd<BStackSlice<'a, A>> for BStackSliceReader<'a, A>
impl<'a, A: BStackAllocator> PartialOrd<BStackSlice<'a, A>> for BStackSliceReader<'a, A>
Source§impl<'a, A: BStackAllocator> PartialOrd<BStackSliceReader<'a, A>> for BStackSlice<'a, A>
impl<'a, A: BStackAllocator> PartialOrd<BStackSliceReader<'a, A>> for BStackSlice<'a, A>
Source§impl<'a, A: BStackAllocator> PartialOrd<BStackSliceReader<'a, A>> for BStackSliceWriter<'a, A>
Available on crate feature set only.
impl<'a, A: BStackAllocator> PartialOrd<BStackSliceReader<'a, A>> for BStackSliceWriter<'a, A>
set only.Source§impl<'a, A: BStackAllocator> PartialOrd<BStackSliceWriter<'a, A>> for BStackSliceReader<'a, A>
Available on crate feature set only.
impl<'a, A: BStackAllocator> PartialOrd<BStackSliceWriter<'a, A>> for BStackSliceReader<'a, A>
set only.Source§impl<'a, A: BStackAllocator> PartialOrd for BStackSliceReader<'a, A>
impl<'a, A: BStackAllocator> PartialOrd for BStackSliceReader<'a, A>
Source§impl<'a, A: BStackAllocator> Read for BStackSliceReader<'a, A>
impl<'a, A: BStackAllocator> Read for BStackSliceReader<'a, A>
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
1.36.0 · Source§fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
read, except that it reads into a slice of buffers. Read moreSource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
can_vector)1.0.0 · Source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
buf. Read more1.0.0 · Source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
buf. Read more1.6.0 · Source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
buf. Read moreSource§fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
read_buf)Source§fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
read_buf)cursor. Read more1.0.0 · Source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Read. Read more1.0.0 · Source§fn chain<R>(self, next: R) -> Chain<Self, R>
fn chain<R>(self, next: R) -> Chain<Self, R>
Source§impl<'a, A: BStackAllocator> Seek for BStackSliceReader<'a, A>
impl<'a, A: BStackAllocator> Seek for BStackSliceReader<'a, A>
Source§fn seek(&mut self, pos: SeekFrom) -> Result<u64>
fn seek(&mut self, pos: SeekFrom) -> Result<u64>
Move the cursor within the slice’s coordinate space.
io::SeekFrom::End is relative to self.slice.len. Seeking past
the end is allowed; subsequent reads return Ok(0). Seeking before
position 0 returns io::ErrorKind::InvalidInput.
1.55.0 · Source§fn rewind(&mut self) -> Result<(), Error>
fn rewind(&mut self) -> Result<(), Error>
Source§fn stream_len(&mut self) -> Result<u64, Error>
fn stream_len(&mut self) -> Result<u64, Error>
seek_stream_len)