Struct ZCursor
pub struct ZCursor<T> { /* private fields */ }
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
impl<T: AsRef<[u8]>> ZCursor<T>
fn skip(&mut self, num: usize)Move forward
numbytes from the current position.It doesn't check that position overflowed, new position may point past the internal buffer, all subsequent reads will either return an error or zero depending on the method called
fn rewind(&mut self, num: usize)Move back
numbytes from the current positionThis saturates at zero, it can never be negative or wraparound when the value becomes too small
fn split(&self) -> (&[u8], &[u8])
impl<T: AsRef<[u8]>> ZCursor<T>
fn new(buffer: T) -> ZCursor<T>
Trait Implementations
impl<T: AsRef<[u8]>> BufRead for ZCursor<T>
fn fill_buf(&mut self) -> Result<&[u8]>fn consume(&mut self, amount: usize)
impl<T: AsRef<[u8]>> From<T> for ZCursor<T>
fn from(value: T) -> Self
impl<T: AsRef<[u8]>> Read for ZCursor<T>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
impl<T: AsRef<[u8]>> Seek for ZCursor<T>
fn seek(&mut self, pos: SeekFrom) -> Result<u64>
Auto 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> UnsafeUnpin for ZCursor<T>
where
T: UnsafeUnpin,
impl<T> UnwindSafe for ZCursor<T>
where
T: UnwindSafe,
Blanket Implementations
impl<T> Any for ZCursor<T>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for ZCursor<T>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for ZCursor<T>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for ZCursor<T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ZByteReaderTrait for ZCursor<T>
where
T: BufRead + Seek,
fn read_byte_no_error(&mut self) -> u8fn read_exact_bytes(&mut self, buf: &mut [u8]) -> Result<(), ZByteIoError>fn read_bytes(&mut self, buf: &mut [u8]) -> Result<usize, ZByteIoError>fn peek_bytes(&mut self, buf: &mut [u8]) -> Result<usize, ZByteIoError>fn peek_exact_bytes(&mut self, buf: &mut [u8]) -> Result<(), ZByteIoError>fn z_seek(&mut self, from: ZSeekFrom) -> Result<u64, ZByteIoError>fn is_eof(&mut self) -> Result<bool, ZByteIoError>fn z_position(&mut self) -> Result<u64, ZByteIoError>fn read_remaining(&mut self, sink: &mut Vec<u8>) -> Result<usize, ZByteIoError>
impl<T, U> Into<U> for ZCursor<T>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for ZCursor<T>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for ZCursor<T>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>