BufRead

Trait BufRead 

Source
pub trait BufRead: Read {
    // Required methods
    fn fill_buf(&mut self) -> Result<&[u8]>;
    fn consume(&mut self, amt: usize);

    // Provided method
    fn has_data_left(&mut self) -> Result<bool> { ... }
}
Expand description

A BufRead is a type of Reader which has an internal buffer, allowing it to perform extra ways of reading.

Required Methods§

Source

fn fill_buf(&mut self) -> Result<&[u8]>

Returns the contents of the internal buffer, filling it with more data from the inner reader if it is empty.

Source

fn consume(&mut self, amt: usize)

Tells this buffer that amt bytes have been consumed from the buffer, so they should no longer be returned in calls to read.

Provided Methods§

Source

fn has_data_left(&mut self) -> Result<bool>

Check if the underlying Read has any data left to be read.

Implementors§