[−][src]Struct gchemol_parser::TextReader
A stream reader for large text file
Methods
impl TextReader<BufReader<File>>[src]
pub fn from_path<P: AsRef<Path>>(p: P) -> Result<Self>[src]
Build a text reader for file from path p.
impl<'a> TextReader<Cursor<&'a str>>[src]
impl<R: Read> TextReader<BufReader<R>>[src]
impl<R: BufRead + Seek> TextReader<R>[src]
pub fn seek_line<F>(&mut self, f: F) -> Result<u64> where
F: Fn(&str) -> bool, [src]
F: Fn(&str) -> bool,
Skip reading until finding a matched line. Return the position before the matched line.
impl<R: BufRead> TextReader<R>[src]
pub fn read_line(&mut self, buf: &mut String) -> Option<usize>[src]
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.
pub fn lines(self) -> impl Iterator<Item = String>[src]
Returns an iterator over the lines of this reader. Each string returned will not have a line ending.
pub fn read_to_string(&mut self, buf: &mut String) -> Result<usize>[src]
Read all text into string buf (Note: out of memory issue for large
file)
impl<R: BufRead> TextReader<R>[src]
ⓘImportant traits for Partitions<R, P>pub fn partition_by<P: Partition>(self, p: P) -> Partitions<R, P>[src]
Use partitions instead
Returns an iterator over n lines at a time.
impl<R: BufRead> TextReader<R>[src]
ⓘImportant traits for Partitions<R, P>pub fn terminated_bunches<F>(self, f: F) -> Partitions<R, Terminated<F>> where
F: Fn(&str) -> bool, [src]
F: Fn(&str) -> bool,
Use partitions_terminated instead
Returns an iterator over n lines at a time.
impl<R: BufRead> TextReader<R>[src]
ⓘImportant traits for Partitions<R, P>pub fn preceded_bunches<F>(self, f: F) -> Partitions<R, Preceded<F>> where
F: Fn(&str) -> bool, [src]
F: Fn(&str) -> bool,
Use partitions_preceded instead
Returns an iterator over n lines at a time.
impl<R: BufRead> TextReader<R>[src]
ⓘImportant traits for Bunches<F, R>pub fn bunches<F>(self, label_fn: F) -> Bunches<F, R> where
F: Fn(&str) -> bool, [src]
F: Fn(&str) -> bool,
Plan to be removed
Return an iterator over a bunch of lines preceded by a label line.
impl<R: BufRead> TextReader<R>[src]
ⓘImportant traits for Partitions<R, P>pub fn partitions<P>(self, p: P) -> Partitions<R, P> where
P: ReadPart, [src]
P: ReadPart,
Returns an iterator over part of text, using a generic text partioner
p.
impl<R: BufRead> TextReader<R>[src]
ⓘImportant traits for Partitions<R, P>pub fn chunks(self, n: usize) -> Partitions<R, Chunks>[src]
Returns an iterator over each part of text in n lines.
impl<R: BufRead> TextReader<R>[src]
ⓘImportant traits for Partitions<R, P>pub fn partitions_terminated<F>(self, f: F) -> Partitions<R, Terminated<F>> where
F: Fn(&str) -> bool, [src]
F: Fn(&str) -> bool,
Returns an iterator over a part of text terminated with a tail line.
impl<R: BufRead> TextReader<R>[src]
ⓘImportant traits for Partitions<R, P>pub fn partitions_preceded<F>(self, f: F) -> Partitions<R, Preceded<F>> where
F: Fn(&str) -> bool, [src]
F: Fn(&str) -> bool,
Returns an iterator over a part of text preceded with a head line.
Trait Implementations
impl<R: Debug + BufRead> Debug for TextReader<R>[src]
Auto Trait Implementations
impl<R> RefUnwindSafe for TextReader<R> where
R: RefUnwindSafe,
R: RefUnwindSafe,
impl<R> Send for TextReader<R> where
R: Send,
R: Send,
impl<R> Sync for TextReader<R> where
R: Sync,
R: Sync,
impl<R> Unpin for TextReader<R> where
R: Unpin,
R: Unpin,
impl<R> UnwindSafe for TextReader<R> where
R: UnwindSafe,
R: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,