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

An error type representing any error related to reading bytes.

Required Methods

Reads a sequence of bytes from the Unpacker. This sequence must be long enough to fill bytes completely. This method must fail if the unpacker does not have enough bytes to fulfill the request.

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.

Returns the exact number of read bytes if possible.

Implementations on Foreign Types

Implementors