pub struct Decoder<'a> { /* private fields */ }Expand description
Reads what an Encoder wrote.
Implementations§
Source§impl<'a> Decoder<'a>
impl<'a> Decoder<'a>
pub fn new(input: &'a [u8]) -> Result<Self, DecodeError>
pub fn u64(&mut self) -> Result<u64, DecodeError>
pub fn u32(&mut self) -> Result<u32, DecodeError>
pub fn usize(&mut self) -> Result<usize, DecodeError>
pub fn bool(&mut self) -> Result<bool, DecodeError>
pub fn byte(&mut self) -> Result<u8, DecodeError>
pub fn str(&mut self) -> Result<&'a str, DecodeError>
pub fn string(&mut self) -> Result<String, DecodeError>
pub fn opt_string(&mut self) -> Result<Option<String>, DecodeError>
pub fn strings(&mut self) -> Result<Vec<String>, DecodeError>
pub fn blob(&mut self) -> Result<&'a [u8], DecodeError>
Sourcepub fn count(&mut self) -> Result<usize, DecodeError>
pub fn count(&mut self) -> Result<usize, DecodeError>
A count of items still to come, each at least one byte long; see
count_of.
Sourcepub fn count_of(&mut self, min_len: usize) -> Result<usize, DecodeError>
pub fn count_of(&mut self, min_len: usize) -> Result<usize, DecodeError>
A count of items still to come, each taking at least min_len bytes,
checked against the bytes left. A count the bytes cannot hold fails
here, before the caller reserves room for that many items, so a
damaged or hostile count cannot ask for an allocation larger than a
real record of the same size would need.
pub fn finish(self) -> Result<(), DecodeError>
Trait Implementations§
Auto Trait Implementations§
impl<'a> Forget for Decoder<'a>
impl<'a> Freeze for Decoder<'a>
impl<'a> Move for Decoder<'a>
impl<'a> RefUnwindSafe for Decoder<'a>
impl<'a> Send for Decoder<'a>
impl<'a> Sync for Decoder<'a>
impl<'a> Unpin for Decoder<'a>
impl<'a> UnsafeUnpin for Decoder<'a>
impl<'a> UnwindSafe for Decoder<'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