pub trait ReadExactEx: Read {
    fn read_exact_or_to_end(&mut self, buf: &mut [u8]) -> Result<usize> { ... }
    fn read_exact_or_none(&mut self, buf: &mut [u8]) -> Result<bool> { ... }
}
Expand description

A trait that extends Read with methods that ease reading from chunked files.

Provided Methods§

Reads all bytes to fill buf or until EOF. If successful, returns the total number of bytes read.

This function behaves like Read::read_to_end but it reads data into the mutable slice instead of into a Vec and stops reading when the whole buf has been filled.

Reads the exact number of bytes required to fill buf and returns Ok(true) or returns Ok(false) if exactly zero bytes were read. In this instance, buf will be left unmodified.

If at least one byte was read, this function behaves exactly like Read::read_exact.

Implementors§