Struct SimpleSliceDeserializer

Source
pub struct SimpleSliceDeserializer<'a> { /* private fields */ }
Expand description

This struct implements a simple data deserializer. It is the counterpart of the SimpleDataSerializer trait.

The template parameter E is the type used to define the type of the error that will compose the results. The actual value of E is defined by the constructor.

Implementations§

Source§

impl<'a> SimpleSliceDeserializer<'a>

Source

pub fn new(data: &'a [u8]) -> Self

Creates a new instance that reads data from the slice and returns the specified value on error.

Source

pub fn offset(&self) -> usize

Returns the current offset.

Source

pub fn avaliable(&self) -> usize

Return the number of bytes availble.

Source

pub fn is_empty(&self) -> bool

Returns true if there is no more bytes to read.

Trait Implementations§

Source§

impl<'a> SimpleDataDeserializer for SimpleSliceDeserializer<'a>

Source§

fn data(&self) -> &[u8]

The slice with the last data read.
Source§

fn read(&mut self, size: usize) -> Result<()>

Reads the specified umber of bytes. The data read will available by Self::data(). Read more
Source§

fn read_u8(&mut self) -> Result<u8>

Reads an u8 value.
Source§

fn read_i8(&mut self) -> Result<i8>

Reads an i8 value.
Source§

fn read_u16(&mut self) -> Result<u16>

Reads an u16 value.
Source§

fn read_u32(&mut self) -> Result<u32>

Reads an u32 value.
Source§

fn read_u64(&mut self) -> Result<u64>

Reads an u16 value.
Source§

fn read_i16(&mut self) -> Result<i16>

Reads an i16 value.
Source§

fn read_i32(&mut self) -> Result<i32>

Reads an i32 value.
Source§

fn read_i64(&mut self) -> Result<i64>

Reads an i64 value.
Source§

fn read_f32(&mut self) -> Result<f32>

Reads an f32 value.
Source§

fn read_f64(&mut self) -> Result<f64>

Reads an f64 value.
Source§

fn read_byte_array(&mut self) -> Result<()>

Writes a byte array. The size of the byte array is encoded as an u16 value followed by the bytes of the array. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V