pub trait BytesLike<'encoding>: Sized {
type ExternallyTrackedLength: Sized + Copy;
// Required methods
fn len(&self, len: Self::ExternallyTrackedLength) -> usize;
fn read_bytes(
&mut self,
bytes: usize,
) -> Result<(Self::ExternallyTrackedLength, Self), EpeeError>;
fn read_into_slice(&mut self, slice: &mut [u8]) -> Result<(), EpeeError>;
// Provided methods
fn read_byte(&mut self) -> Result<u8, EpeeError> { ... }
fn advance<const N: usize>(&mut self) -> Result<(), EpeeError> { ... }
}Expand description
An item which is like a &[u8].
Required Associated Types§
Sourcetype ExternallyTrackedLength: Sized + Copy
type ExternallyTrackedLength: Sized + Copy
The type representing the length of a read BytesLike, if a BytesLike does not
inherently know its length.
This should be usize or ().
Required Methods§
Sourcefn len(&self, len: Self::ExternallyTrackedLength) -> usize
fn len(&self, len: Self::ExternallyTrackedLength) -> usize
The length of these bytes.
Sourcefn read_bytes(
&mut self,
bytes: usize,
) -> Result<(Self::ExternallyTrackedLength, Self), EpeeError>
fn read_bytes( &mut self, bytes: usize, ) -> Result<(Self::ExternallyTrackedLength, Self), EpeeError>
Read a fixed amount of bytes from the container.
This MUST return Ok((len, slice)) where slice is the expected length or Err(_).
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.