pub trait Unpacker: Sized {
type Error;
fn unpack_bytes<B: AsMut<[u8]>>(
&mut self,
bytes: B
) -> Result<(), Self::Error>;
fn ensure_bytes(&self, _len: usize) -> Result<(), Self::Error> { ... }
fn read_bytes(&self) -> Option<usize> { ... }
}
Expand description
A type that can unpack any value that implements Packable
.
Required Associated Types
Required Methods
Provided Methods
Tries to guarantee that the Unpacker
has at least len
bytes.
This method must fail if and only if it is certain that there are not enough bytes and
it is allowed to return Ok(())
in any other case.
fn read_bytes(&self) -> Option<usize>
fn read_bytes(&self) -> Option<usize>
Returns the exact number of read bytes if possible.