InputBufferExt

Trait InputBufferExt 

Source
pub trait InputBufferExt: InputBuffer {
    // Provided methods
    fn read_to_vec_exact(&mut self, len: usize) -> Result<Vec<u8>, Errno> { ... }
    fn read_to_vec_limited(&mut self, limit: usize) -> Result<Vec<u8>, Errno> { ... }
    fn read_to_array<const N: usize>(&mut self) -> Result<[u8; N], Errno> { ... }
    fn read_to_object<T: FromBytes>(&mut self) -> Result<T, Errno> { ... }
}

Provided Methods§

Source

fn read_to_vec_exact(&mut self, len: usize) -> Result<Vec<u8>, Errno>

Reads exactly len bytes into a returned Vec.

Returns an error if len is larger than the number of available bytes.

Source

fn read_to_vec_limited(&mut self, limit: usize) -> Result<Vec<u8>, Errno>

Reads up to limit bytes into a returned Vec.

Source

fn read_to_array<const N: usize>(&mut self) -> Result<[u8; N], Errno>

Reads bytes into the array.

Returns an error if N is larger than the number of available bytes.

Source

fn read_to_object<T: FromBytes>(&mut self) -> Result<T, Errno>

Interprets the buffer as an object.

Returns an error if the buffer does not have enough bytes to represent the object.

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.

Implementors§