pub struct Cursor<'a> { /* private fields */ }Expand description
Zero-copy bounds-checked little-endian slice reader.
Implementations§
Source§impl<'a> Cursor<'a>
impl<'a> Cursor<'a>
pub const fn new(buf: &'a [u8]) -> Self
pub const fn pos(&self) -> usize
pub const fn remaining(&self) -> usize
pub fn remaining_slice(&self) -> &'a [u8] ⓘ
pub fn read_bytes(&mut self, len: usize) -> Result<&'a [u8], FormatError>
pub fn read_array<const N: usize>(&mut self) -> Result<[u8; N], FormatError>
pub fn read_u8(&mut self) -> Result<u8, FormatError>
pub fn read_u16(&mut self) -> Result<u16, FormatError>
pub fn read_u32(&mut self) -> Result<u32, FormatError>
pub fn read_u64(&mut self) -> Result<u64, FormatError>
pub fn read_u128(&mut self) -> Result<u128, FormatError>
pub fn read_i32(&mut self) -> Result<i32, FormatError>
pub fn read_i64(&mut self) -> Result<i64, FormatError>
pub fn read_f32(&mut self) -> Result<f32, FormatError>
pub fn read_f64(&mut self) -> Result<f64, FormatError>
pub fn read_uvarint(&mut self) -> Result<u64, FormatError>
pub fn read_svarint(&mut self) -> Result<i64, FormatError>
pub fn read_str(&mut self) -> Result<&'a str, FormatError>
pub fn read_string(&mut self) -> Result<String, FormatError>
Trait Implementations§
Auto Trait Implementations§
impl<'a> Forget for Cursor<'a>
impl<'a> Freeze for Cursor<'a>
impl<'a> Move 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>where
&'a [u8]: UnsafeUnpin,
impl<'a> UnwindSafe for Cursor<'a>where
&'a [u8]: 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