Trait capnp::io::Read

source ·
pub trait Read {
    // Required method
    fn read(&mut self, buf: &mut [u8]) -> Result<usize>;

    // Provided method
    fn read_exact(&mut self, buf: &mut [u8]) -> Result<()> { ... }
}
Expand description

A rough approximation of std::io::Read.

Required Methods§

source

fn read(&mut self, buf: &mut [u8]) -> Result<usize>

Attempts to read some bytes into buf and returns the number of bytes read. A return value of Ok(0) means that the end of the stream was reached.

Unlike with std::io::Read, implementations are expected to handle EINTR (i.e. std::io::ErrorKind::Interrupted) internally, by looping until either success is achieved or some other error is hit.

Provided Methods§

source

fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>

Implementors§

source§

impl<R> Read for R
where R: Read,