Trait Input

Source
pub trait Input {
    type Error;

    // Required method
    fn read(&mut self, into: &mut [u8]) -> Result<(), Self::Error>;

    // Provided method
    fn read_byte(&mut self) -> Result<u8, Self::Error> { ... }
}
Expand description

Trait that allows reading of data into a slice.

Required Associated Types§

Source

type Error

Error type of this input.

Required Methods§

Source

fn read(&mut self, into: &mut [u8]) -> Result<(), Self::Error>

Read the exact number of bytes required to fill the given buffer.

Note that this function is similar to std::io::Read::read_exact and not std::io::Read::read.

Provided Methods§

Source

fn read_byte(&mut self) -> Result<u8, Self::Error>

Read a single byte from the input.

Implementors§

Source§

impl<R: Read> Input for R