Struct bincode::de::read::SliceReader
source · pub struct SliceReader<'storage> { /* private fields */ }
Expand description
A reader type for &[u8]
slices. Implements both Reader and BorrowReader, and thus can be used for borrowed data.
Implementations§
source§impl<'storage> SliceReader<'storage>
impl<'storage> SliceReader<'storage>
sourcepub fn new(bytes: &'storage [u8]) -> SliceReader<'storage>
pub fn new(bytes: &'storage [u8]) -> SliceReader<'storage>
Constructs a slice reader
Trait Implementations§
source§impl<'storage> BorrowReader<'storage> for SliceReader<'storage>
impl<'storage> BorrowReader<'storage> for SliceReader<'storage>
source§fn take_bytes(&mut self, length: usize) -> Result<&'storage [u8], DecodeError>
fn take_bytes(&mut self, length: usize) -> Result<&'storage [u8], DecodeError>
Read exactly
length
bytes and return a slice to this data. If not enough bytes could be read, an error should be returned. Read moresource§impl<'storage> Reader for SliceReader<'storage>
impl<'storage> Reader for SliceReader<'storage>
source§fn read(&mut self, bytes: &mut [u8]) -> Result<(), DecodeError>
fn read(&mut self, bytes: &mut [u8]) -> Result<(), DecodeError>
Fill the given
bytes
argument with values. Exactly the length of the given slice must be filled, or else an error must be returned.Auto Trait Implementations§
impl<'storage> Freeze for SliceReader<'storage>
impl<'storage> RefUnwindSafe for SliceReader<'storage>
impl<'storage> Send for SliceReader<'storage>
impl<'storage> Sync for SliceReader<'storage>
impl<'storage> Unpin for SliceReader<'storage>
impl<'storage> UnwindSafe for SliceReader<'storage>
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