pub struct BinaryDeserializerFromBufSafe<'a> { /* private fields */ }Expand description
a deserializer which deserializes values from a buffer and performs bounds checks on the buffer when deserializing to avoid panics.
Implementations§
source§impl<'a> BinaryDeserializerFromBufSafe<'a>
impl<'a> BinaryDeserializerFromBufSafe<'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, SerdeBufSafeError>
pub fn deserialize<T: BinarySerde>(&mut self) -> Result<T, SerdeBufSafeError>
deserializes a value of type T from the current position in the buffer, and advances the position accordingly.
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.
Auto Trait Implementations§
impl<'a> RefUnwindSafe for BinaryDeserializerFromBufSafe<'a>
impl<'a> Send for BinaryDeserializerFromBufSafe<'a>
impl<'a> Sync for BinaryDeserializerFromBufSafe<'a>
impl<'a> Unpin for BinaryDeserializerFromBufSafe<'a>
impl<'a> UnwindSafe for BinaryDeserializerFromBufSafe<'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