pub struct FieldDecoder<'a> { /* private fields */ }Expand description
A sequential field decoder that reads typed values from a byte buffer.
Each read_* method advances an internal offset. The methods return
PersistError::SerializationError if there are not enough bytes
remaining.
Implementations§
Source§impl<'a> FieldDecoder<'a>
impl<'a> FieldDecoder<'a>
Sourcepub fn is_exhausted(&self) -> bool
pub fn is_exhausted(&self) -> bool
Returns true if all bytes have been consumed.
Sourcepub fn read_string(&mut self) -> Result<String>
pub fn read_string(&mut self) -> Result<String>
Reads a length-prefixed UTF-8 string.
Sourcepub fn read_bytes(&mut self) -> Result<Vec<u8>>
pub fn read_bytes(&mut self) -> Result<Vec<u8>>
Reads a length-prefixed byte slice.
Sourcepub fn read_option_string(&mut self) -> Result<Option<String>>
pub fn read_option_string(&mut self) -> Result<Option<String>>
Reads an optional string (bool tag + optional value).
Sourcepub fn read_option_u64(&mut self) -> Result<Option<u64>>
pub fn read_option_u64(&mut self) -> Result<Option<u64>>
Reads an optional u64 (bool tag + optional value).
Auto Trait Implementations§
impl<'a> Freeze for FieldDecoder<'a>
impl<'a> RefUnwindSafe for FieldDecoder<'a>
impl<'a> Send for FieldDecoder<'a>
impl<'a> Sync for FieldDecoder<'a>
impl<'a> Unpin for FieldDecoder<'a>
impl<'a> UnsafeUnpin for FieldDecoder<'a>
impl<'a> UnwindSafe for FieldDecoder<'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