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

a deserializer which deserializes values from a buffer.

Implementations§

source§

impl<'a> BinaryDeserializerFromBuf<'a>

source

pub fn new(buf: &'a [u8], endianness: Endianness) -> Self

creates a new deserializer which deserializes values from the given buffer using the given endianness.

source

pub fn deserialize<T: BinarySerde>(&mut self) -> Result<T, DeserializeError>

deserializes a value of type T from the current position in the buffer, and advances the position accordingly.

Panics

this function panics if the deserialization exceeds the bounds of the buffer.

source

pub fn position(&self) -> usize

returns the current position of this deserializer in the buffer.

source

pub fn set_position(&mut self, new_position: usize)

sets the position of this deserializer in the buffer.

source

pub fn move_forwards(&mut self, amount: usize)

moves this deserializer’s position forwards according to the given amount.

source

pub fn move_backwards(&mut self, amount: usize)

moves this deserializer’s position backwards according to the given amount.

source

pub fn set_endianness(&mut self, new_endianness: Endianness)

sets the endianness of this deserializer

source

pub fn buf(&self) -> &'a [u8]

returns a reference to the underlying buffer of this deserializer

Trait Implementations§

source§

impl<'a> Clone for BinaryDeserializerFromBuf<'a>

source§

fn clone(&self) -> BinaryDeserializerFromBuf<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.