pub struct Cursor<'a> { /* private fields */ }Expand description
A cursor over a byte slice with byte-order-aware reads.
Implementations§
Source§impl<'a> Cursor<'a>
impl<'a> Cursor<'a>
pub fn new(data: &'a [u8], byte_order: ByteOrder) -> Self
pub fn with_offset( data: &'a [u8], offset: usize, byte_order: ByteOrder, ) -> Result<Self>
pub fn position(&self) -> usize
pub fn remaining(&self) -> usize
pub fn read_u8(&mut self) -> Result<u8>
pub fn read_u16(&mut self) -> Result<u16>
pub fn read_u32(&mut self) -> Result<u32>
pub fn read_u64(&mut self) -> Result<u64>
pub fn read_f64(&mut self) -> Result<f64>
pub fn read_bytes(&mut self, n: usize) -> Result<&'a [u8]>
pub fn skip(&mut self, n: usize) -> Result<()>
Auto Trait Implementations§
impl<'a> Freeze for Cursor<'a>
impl<'a> RefUnwindSafe for Cursor<'a>
impl<'a> Send for Cursor<'a>
impl<'a> Sync for Cursor<'a>
impl<'a> Unpin for Cursor<'a>
impl<'a> UnsafeUnpin for Cursor<'a>
impl<'a> UnwindSafe for Cursor<'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
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