Trait simple_bytes::BytesReadRef
source · [−]pub trait BytesReadRef<'a>: BytesRead {
fn as_slice_ref(&self) -> &'a [u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
;
fn remaining_ref(&self) -> &'a [u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
;
fn try_read_ref(&mut self, len: usize) -> Result<&'a [u8], ReadError>;
fn peek_ref(&self, len: usize) -> Option<&'a [u8]>;
fn read_ref(&mut self, len: usize) -> &'a [u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
{ ... }
}
Expand description
Read bytes while keeping the original reference.
use simple_bytes::{Bytes, BytesRead, BytesReadRef};
let mut bytes = Bytes::from("hey".as_ref());
let h = bytes.read_u8();
let ey: &'static [u8] = bytes.remaining_ref();
Required Methods
Returns the entire slice.
Returns all remaining bytes.