Skip to main content

Read

Trait Read 

Source
pub trait Read {
    // Required method
    fn read(&mut self, buf: &mut Vec<u8>) -> Result<bool, ReadError>;
}
Expand description

Custom read abstraction that allows Reader to work without std::io::Read.

This trait is automatically implemented for &[u8] and, when the std feature is enabled, for any std::io::Read type.

Required Methods§

Source

fn read(&mut self, buf: &mut Vec<u8>) -> Result<bool, ReadError>

Read data into buf, appending to its contents.

Returns Ok(true) if more data may be available (caller should try again), or Ok(false) to signal end-of-input.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<R: Read> Read for R

Available on crate feature std only.