Struct gchemol_parser::TextReader
source · pub struct TextReader<R: BufRead> { /* private fields */ }Expand description
A stream reader for large text file
Implementations§
source§impl TextReader<BufReader<File>>
impl TextReader<BufReader<File>>
source§impl<'a> TextReader<Cursor<&'a str>>
impl<'a> TextReader<Cursor<&'a str>>
source§impl<R: Read> TextReader<BufReader<R>>
impl<R: Read> TextReader<BufReader<R>>
source§impl<R: BufRead + Seek> TextReader<R>
impl<R: BufRead + Seek> TextReader<R>
source§impl<R: BufRead> TextReader<R>
impl<R: BufRead> TextReader<R>
sourcepub fn read_line(&mut self, buf: &mut String) -> Option<usize>
pub fn read_line(&mut self, buf: &mut String) -> Option<usize>
Read a new line into buf. Note: the new line is forced to use unix style line ending.
This function will return the total number of bytes read.
If this function returns None, the stream has reached EOF.
sourcepub fn lines(self) -> impl Iterator<Item = String>
pub fn lines(self) -> impl Iterator<Item = String>
Returns an iterator over the lines of this reader. Each string returned will not have a line ending.
sourcepub fn read_to_string(&mut self, buf: &mut String) -> Result<usize>
pub fn read_to_string(&mut self, buf: &mut String) -> Result<usize>
Read all text into string buf (Note: out of memory issue for large
file)
source§impl<R: BufRead> TextReader<R>
impl<R: BufRead> TextReader<R>
sourcepub fn partitions<P>(self, p: P) -> Partitions<R, P> ⓘwhere
P: ReadPart,
pub fn partitions<P>(self, p: P) -> Partitions<R, P> ⓘwhere
P: ReadPart,
Returns an iterator over part of text, using a generic text partioner
p.
source§impl<R: BufRead> TextReader<R>
impl<R: BufRead> TextReader<R>
source§impl<R: BufRead> TextReader<R>
impl<R: BufRead> TextReader<R>
sourcepub fn partitions_terminated<F>(self, f: F) -> Partitions<R, Terminated<F>> ⓘwhere
F: Fn(&str) -> bool,
pub fn partitions_terminated<F>(self, f: F) -> Partitions<R, Terminated<F>> ⓘwhere
F: Fn(&str) -> bool,
Returns an iterator over a part of text terminated with a tail line.
source§impl<R: BufRead> TextReader<R>
impl<R: BufRead> TextReader<R>
sourcepub fn partitions_preceded<F>(self, f: F) -> Partitions<R, Preceded<F>> ⓘwhere
F: Fn(&str) -> bool,
pub fn partitions_preceded<F>(self, f: F) -> Partitions<R, Preceded<F>> ⓘwhere
F: Fn(&str) -> bool,
Returns an iterator over a part of text preceded with a head line.