Skip to main content

BufReadExt

Trait BufReadExt 

Source
pub trait BufReadExt: BufRead {
    // Provided method
    fn lending_lines(&mut self) -> LendingLines<'_, Self>
       where Self: Sized { ... }
}
Expand description

Extension trait for std::io::BufRead.

Provided Methods§

Source

fn lending_lines(&mut self) -> LendingLines<'_, Self>
where Self: Sized,

Returns a lending iterator over the lines of this reader.

Unlike std::io::BufRead::lines, this iterator reuses a single String buffer and yields lines as &str references bound to the lifetime of the iterator’s next call. This avoids allocating a new string for every line.

Implementors§