Struct binary_serde::BinaryDeserializerFromBuf
source · pub struct BinaryDeserializerFromBuf<'a> { /* private fields */ }
Expand description
a deserializer which deserializes values from a buffer.
Implementations§
source§impl<'a> BinaryDeserializerFromBuf<'a>
impl<'a> BinaryDeserializerFromBuf<'a>
sourcepub fn new(buf: &'a [u8], endianness: Endianness) -> Self
pub fn new(buf: &'a [u8], endianness: Endianness) -> Self
creates a new deserializer which deserializes values from the given buffer using the given endianness.
sourcepub fn deserialize<T: BinarySerde>(&mut self) -> Result<T, DeserializeError>
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.
sourcepub fn position(&self) -> usize
pub fn position(&self) -> usize
returns the current position of this deserializer in the buffer.
sourcepub fn set_position(&mut self, new_position: usize)
pub fn set_position(&mut self, new_position: usize)
sets the position of this deserializer in the buffer.
sourcepub fn move_forwards(&mut self, amount: usize)
pub fn move_forwards(&mut self, amount: usize)
moves this deserializer’s position forwards according to the given amount.
sourcepub fn move_backwards(&mut self, amount: usize)
pub fn move_backwards(&mut self, amount: usize)
moves this deserializer’s position backwards according to the given amount.
sourcepub fn set_endianness(&mut self, new_endianness: Endianness)
pub fn set_endianness(&mut self, new_endianness: Endianness)
sets the endianness of this deserializer
Trait Implementations§
source§impl<'a> Clone for BinaryDeserializerFromBuf<'a>
impl<'a> Clone for BinaryDeserializerFromBuf<'a>
source§fn clone(&self) -> BinaryDeserializerFromBuf<'a>
fn clone(&self) -> BinaryDeserializerFromBuf<'a>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<'a> RefUnwindSafe for BinaryDeserializerFromBuf<'a>
impl<'a> Send for BinaryDeserializerFromBuf<'a>
impl<'a> Sync for BinaryDeserializerFromBuf<'a>
impl<'a> Unpin for BinaryDeserializerFromBuf<'a>
impl<'a> UnwindSafe for BinaryDeserializerFromBuf<'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