pub struct ByteArrayReader<'a> { /* private fields */ }
Expand description
ByteArrayReader
implements a Reader
that
can extract bytes from a borrowed slice of bytes.
Implementations§
Source§impl<'a> ByteArrayReader<'a>
impl<'a> ByteArrayReader<'a>
pub fn new(buff: &'a [u8]) -> ByteArrayReader<'a>
Sourcepub fn can_read(&self, count: usize) -> Result<()>
pub fn can_read(&self, count: usize) -> Result<()>
Verifies if the specified number of bytes can be read from this struct.
Returns:
Result(())
: If it is possible to read the specified number of bytes;Result(ErrorKind::UnableToReadData)
: If it is not possible to read the specified number of bytes;
Trait Implementations§
Source§impl<'a> MemoryReader for ByteArrayReader<'a>
impl<'a> MemoryReader for ByteArrayReader<'a>
Source§fn set_offset(&mut self, offset: usize)
fn set_offset(&mut self, offset: usize)
Sets the current offset. If offset is larger than the length, it will
set the offset to to the length of the data.
Auto Trait Implementations§
impl<'a> Freeze for ByteArrayReader<'a>
impl<'a> RefUnwindSafe for ByteArrayReader<'a>
impl<'a> Send for ByteArrayReader<'a>
impl<'a> Sync for ByteArrayReader<'a>
impl<'a> Unpin for ByteArrayReader<'a>
impl<'a> UnwindSafe for ByteArrayReader<'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