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
sourceimpl<'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
sourceimpl<'storage> BorrowReader<'storage> for SliceReader<'storage>
impl<'storage> BorrowReader<'storage> for SliceReader<'storage>
sourcefn 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 moresourceimpl<'storage> Reader for SliceReader<'storage>
impl<'storage> Reader for SliceReader<'storage>
sourcefn 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> 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more