Deserializer

Trait Deserializer 

Source
pub trait Deserializer<'a> {
    // Required methods
    fn is_empty(&self) -> bool;
    fn advance(&mut self, len: usize) -> Result<Self>
       where Self: Sized;
    fn pop(&mut self, len: usize) -> Result<Cow<'a, [u8]>>;
}
Expand description

A trait for deserializing data from a byte slice.

Required Methods§

Source

fn is_empty(&self) -> bool

Checks if the deserializer is empty.

Source

fn advance(&mut self, len: usize) -> Result<Self>
where Self: Sized,

Advances the deserializer by the specified length.

§Errors

Returns an error if the length to advance exceeds the available data.

Source

fn pop(&mut self, len: usize) -> Result<Cow<'a, [u8]>>

Pops the specified length of data from the deserializer.

§Errors

Returns an error if the length to pop exceeds the available data.

Implementations on Foreign Types§

Source§

impl<'a> Deserializer<'a> for &'a [u8]

Implements the Deserializer trait for a byte slice.

Source§

fn is_empty(&self) -> bool

Checks if the byte slice is empty.

Source§

fn advance(&mut self, len: usize) -> Result<Self>
where Self: Sized,

Advances the byte slice by the specified length.

§Errors

Returns an error if the length to advance exceeds the available data.

Source§

fn pop(&mut self, len: usize) -> Result<Cow<'a, [u8]>>

Pops the specified length of data from the byte slice.

§Errors

Returns an error if the length to pop exceeds the available data.

Implementors§

Source§

impl<'a> Deserializer<'a> for BytesArray<'a>