pub struct Reader<'a> { /* private fields */ }Expand description
Reader for decoding values from a byte slice.
Implementations§
Source§impl<'a> Reader<'a>
impl<'a> Reader<'a>
Sourcepub fn new(data: &'a [u8], config: Config) -> Self
pub fn new(data: &'a [u8], config: Config) -> Self
Create a new reader with the given byte slice and configuration.
Sourcepub fn read_bool(&mut self) -> Result<bool>
pub fn read_bool(&mut self) -> Result<bool>
Read a boolean (decoded from u8: 0 = false, 1 = true).
Sourcepub fn read_bytes(&mut self, len: usize) -> Result<&'a [u8]>
pub fn read_bytes(&mut self, len: usize) -> Result<&'a [u8]>
Read a byte slice of the given length.
Sourcepub fn bytes_read(&self) -> usize
pub fn bytes_read(&self) -> usize
Get the number of bytes read so far.
Auto Trait Implementations§
impl<'a> Freeze for Reader<'a>
impl<'a> RefUnwindSafe for Reader<'a>
impl<'a> Send for Reader<'a>
impl<'a> Sync for Reader<'a>
impl<'a> Unpin for Reader<'a>
impl<'a> UnwindSafe for Reader<'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