pub struct ByteCursor<'a> { /* private fields */ }Expand description
A read-only cursor over an in-memory byte slice.
Implementations§
Source§impl<'a> ByteCursor<'a>
impl<'a> ByteCursor<'a>
pub fn new(bytes: &'a [u8]) -> Self
pub fn position(&self) -> usize
pub fn remaining(&self) -> usize
pub fn read_u8(&mut self) -> Result<u8, Error>
pub fn read_be_u32(&mut self) -> Result<u32, Error>
pub fn read_be_u64(&mut self) -> Result<u64, Error>
pub fn read_be_i32(&mut self) -> Result<i32, Error>
pub fn read_exact(&mut self, len: usize) -> Result<&'a [u8], Error>
Trait Implementations§
Source§impl<'a> Clone for ByteCursor<'a>
impl<'a> Clone for ByteCursor<'a>
Source§fn clone(&self) -> ByteCursor<'a>
fn clone(&self) -> ByteCursor<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'a> Copy for ByteCursor<'a>
Auto Trait Implementations§
impl<'a> Freeze for ByteCursor<'a>
impl<'a> RefUnwindSafe for ByteCursor<'a>
impl<'a> Send for ByteCursor<'a>
impl<'a> Sync for ByteCursor<'a>
impl<'a> Unpin for ByteCursor<'a>
impl<'a> UnsafeUnpin for ByteCursor<'a>
impl<'a> UnwindSafe for ByteCursor<'a>
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