QBufRead

Trait QBufRead 

Source
pub trait QBufRead {
    // Required methods
    fn read_until_to_bytes(&mut self, byte: u8) -> Result<Vec<u8>>;
    fn read_line_to_string(&mut self) -> Result<String>;
}
Expand description

Trait for implementing ergonomic reads of buffered file content

This trait implements wrappers around two of the methods from std::io::BufRead to handle allocating the necessary buffer for you.

Required Methods§

Source

fn read_until_to_bytes(&mut self, byte: u8) -> Result<Vec<u8>>

Read the content until byte or the content end is reached and returns the bytes read.

This will return the bytes from the current position in the data up to and including the next instance of byte as a new vector of bytes. It only returns an Err if the underlying call to std::io::BufRead::read_until does.

Source

fn read_line_to_string(&mut self) -> Result<String>

Read the content of the next line of the data into a new string.

This will return the next line of the file (or other readable object) as a new string, which it allocates for you. It only returns an Err if the underlying call to std::io::BufRead::read_line does.

Implementors§

Source§

impl<T: BufRead> QBufRead for T