Trait axio::Read

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

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

The Read trait allows for reading bytes from a source.

Required Methods§

source

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

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

Provided Methods§

source

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

Available on crate feature alloc only.

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

source

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

Available on crate feature alloc only.

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

source

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

Read the exact number of bytes required to fill buf.

source

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

Read the exact number of bytes required to fill buf.

Implementations on Foreign Types§

source§

impl Read for &[u8]

source§

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

source§

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

source§

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

Available on crate feature alloc only.

Implementors§

source§

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