pub struct Cursor<'a> { /* private fields */ }Expand description
A sequential cursor over a byte slice.
Implementations§
Source§impl<'a> Cursor<'a>
impl<'a> Cursor<'a>
pub fn new(data: &'a [u8], order: ByteOrder) -> Self
pub fn at(data: &'a [u8], pos: usize, order: ByteOrder) -> Self
pub fn data(&self) -> &'a [u8] ⓘ
pub fn pos(&self) -> usize
pub fn order(&self) -> ByteOrder
pub fn set_order(&mut self, order: ByteOrder)
pub fn seek(&mut self, pos: usize)
pub fn remaining(&self) -> usize
pub fn skip(&mut self, n: usize) -> Result<()>
pub fn bytes(&mut self, n: usize) -> Result<&'a [u8]>
pub fn u8(&mut self) -> Result<u8>
pub fn u16(&mut self) -> Result<u16>
pub fn u32(&mut self) -> Result<u32>
pub fn u64(&mut self) -> Result<u64>
pub fn i16(&mut self) -> Result<i16>
pub fn i32(&mut self) -> Result<i32>
pub fn u16be(&mut self) -> Result<u16>
pub fn u32be(&mut self) -> Result<u32>
Trait Implementations§
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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