pub struct ZCursor<T: AsRef<[u8]>> { /* private fields */ }
Expand description
Wraps an in memory buffer providing it with a Seek
method
but works in no_std
environments
std::io::Cursor
is available in std environments, but we also need support
for no_std
environments so this serves as a drop in replacement
Implementations§
Source§impl<T: AsRef<[u8]>> ZCursor<T>
impl<T: AsRef<[u8]>> ZCursor<T>
Trait Implementations§
Source§impl<T: AsRef<[u8]>> ZByteReaderTrait for ZCursor<T>
impl<T: AsRef<[u8]>> ZByteReaderTrait for ZCursor<T>
Source§fn read_byte_no_error(&mut self) -> u8
fn read_byte_no_error(&mut self) -> u8
Read a single byte from the decoder and return
0
if we can’t read the byte, e.g because of EOF Read moreSource§fn read_exact_bytes(&mut self, buf: &mut [u8]) -> Result<(), ZByteIoError>
fn read_exact_bytes(&mut self, buf: &mut [u8]) -> Result<(), ZByteIoError>
Read exact bytes required to fill
buf
or return an error if that isn’t possible Read moreSource§fn read_const_bytes<const N: usize>(
&mut self,
buf: &mut [u8; N],
) -> Result<(), ZByteIoError>
fn read_const_bytes<const N: usize>( &mut self, buf: &mut [u8; N], ) -> Result<(), ZByteIoError>
Read exact bytes required to fill
buf
or return an error if that isn’t possible Read moreSource§fn read_const_bytes_no_error<const N: usize>(&mut self, buf: &mut [u8; N])
fn read_const_bytes_no_error<const N: usize>(&mut self, buf: &mut [u8; N])
Read exact bytes required to fill
buf
or ignore buf entirely if you can’t fill it
due to an error like the inability to fill the buffer completely Read moreSource§fn read_bytes(&mut self, buf: &mut [u8]) -> Result<usize, ZByteIoError>
fn read_bytes(&mut self, buf: &mut [u8]) -> Result<usize, ZByteIoError>
Read bytes into
buf
returning how many bytes you have read or an error if one occurred Read moreSource§fn peek_bytes(&mut self, buf: &mut [u8]) -> Result<usize, ZByteIoError>
fn peek_bytes(&mut self, buf: &mut [u8]) -> Result<usize, ZByteIoError>
Reads data into provided buffer but does not advance read position.
fn peek_exact_bytes(&mut self, buf: &mut [u8]) -> Result<(), ZByteIoError>
Source§fn z_seek(&mut self, from: ZSeekFrom) -> Result<u64, ZByteIoError>
fn z_seek(&mut self, from: ZSeekFrom) -> Result<u64, ZByteIoError>
Seek into a new position from the buffer Read more
Source§fn is_eof(&mut self) -> Result<bool, ZByteIoError>
fn is_eof(&mut self) -> Result<bool, ZByteIoError>
Report whether we are at the end of a stream. Read more
Source§fn z_position(&mut self) -> Result<u64, ZByteIoError>
fn z_position(&mut self) -> Result<u64, ZByteIoError>
Return the current position of the inner cursor. Read more
Source§fn read_remaining(&mut self, sink: &mut Vec<u8>) -> Result<usize, ZByteIoError>
fn read_remaining(&mut self, sink: &mut Vec<u8>) -> Result<usize, ZByteIoError>
Read all bytes remaining in this input to
sink
until we hit eof Read moreAuto Trait Implementations§
impl<T> Freeze for ZCursor<T>where
T: Freeze,
impl<T> RefUnwindSafe for ZCursor<T>where
T: RefUnwindSafe,
impl<T> Send for ZCursor<T>where
T: Send,
impl<T> Sync for ZCursor<T>where
T: Sync,
impl<T> Unpin for ZCursor<T>where
T: Unpin,
impl<T> UnwindSafe for ZCursor<T>where
T: 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