Trait axstd::io::prelude::Read

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

    // Provided methods
    fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, AxError> { ... }
    fn read_to_string(&mut self, buf: &mut String) -> Result<usize, AxError> { ... }
    fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), AxError> { ... }
}
Expand description

The Read trait allows for reading bytes from a source.

Required Methods§

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

Pull some bytes from this source into the specified buffer, returning how many bytes were read.

Provided Methods§

fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, AxError>

Available on crate feature alloc only.

Read all bytes until EOF in this source, placing them into buf.

fn read_to_string(&mut self, buf: &mut String) -> Result<usize, AxError>

Available on crate feature alloc only.

Read all bytes until EOF in this source, appending them to buf.

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

Read the exact number of bytes required to fill buf.

Implementations on Foreign Types§

§

impl Read for &[u8]

§

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

§

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

§

fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, AxError>

Available on crate feature alloc only.
source§

impl Read for File

source§

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

Implementors§

source§

impl Read for axstd::fs::File

Available on crate feature fs only.
source§

impl Read for TcpStream

Available on crate feature net only.
source§

impl Read for Stdin

source§

impl Read for StdinLock<'_>

§

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