pub struct StateCursor<'a> { /* private fields */ }Expand description
Cursor for reading binary state data.
Implementations§
Source§impl<'a> StateCursor<'a>
impl<'a> StateCursor<'a>
pub fn new(data: &'a [u8]) -> Self
pub fn remaining(&self) -> usize
pub fn read_bytes(&mut self, n: usize) -> Option<&'a [u8]>
Sourcepub fn skip_field(&mut self) -> bool
pub fn skip_field(&mut self) -> bool
Skip the next field (reads its encoded size and advances past it). Returns false if the data is malformed.
§Panics
Does not panic - the expect inside is unreachable because
read_bytes(4) only returns Some when the slice is exactly
4 bytes long.
Auto Trait Implementations§
impl<'a> Freeze for StateCursor<'a>
impl<'a> RefUnwindSafe for StateCursor<'a>
impl<'a> Send for StateCursor<'a>
impl<'a> Sync for StateCursor<'a>
impl<'a> Unpin for StateCursor<'a>
impl<'a> UnsafeUnpin for StateCursor<'a>
impl<'a> UnwindSafe for StateCursor<'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