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
Sourcepub fn endianness(&self) -> Endianness
pub fn endianness(&self) -> Endianness
returns 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 duplicate 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> Freeze for BinaryDeserializerFromBuf<'a>
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