pub trait Read {
// Required method
fn read(&mut self, buf: &mut [u8]) -> Result<usize, ReadError>;
}Expand description
Types implementing this trait act as byte streams.
§Note
Provides a subset of the interface provided by Rust’s std::io::Read trait.
Required Methods§
Sourcefn read(&mut self, buf: &mut [u8]) -> Result<usize, ReadError>
fn read(&mut self, buf: &mut [u8]) -> Result<usize, ReadError>
Pull some bytes from this source into the specified buffer, returning how many bytes were read.
§Note
Provides the same guarantees to the caller as std::io::Read::read.
§Errors
- If
selfstream is already at its end. - For any unknown error returned by the generic
Readimplementer.