[][src]Struct gchemol_parser::TextReader

pub struct TextReader<R: BufRead> { /* fields omitted */ }

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]

pub fn from_str(s: &'a str) -> Self[src]

Build a text reader for string slice.

impl<R: Read> TextReader<BufReader<R>>[src]

pub fn new(r: R) -> Self[src]

Build a text reader from a struct implementing Read trait.

impl<R: BufRead + Seek> TextReader<R>[src]

pub fn seek_line<F>(&mut self, f: F) -> Result<u64> where
    F: Fn(&str) -> bool
[src]

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. Return the length of the new line. Note: the new line is forced to use unix style line ending.

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.

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]

Returns an iterator over n lines at a time.

impl<R: BufRead> TextReader<R>[src]

Important traits for Chunks<R>
pub fn chunks(self, nlines: usize) -> Chunks<R>[src]

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]

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]

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]

Deprecated:

Plan to be removed

Return an iterator over a bunch of lines preceded by a label line.

Trait Implementations

impl<R: Debug + BufRead> Debug for TextReader<R>[src]

Auto Trait Implementations

impl<R> RefUnwindSafe for TextReader<R> where
    R: RefUnwindSafe

impl<R> Send for TextReader<R> where
    R: Send

impl<R> Sync for TextReader<R> where
    R: Sync

impl<R> Unpin for TextReader<R> where
    R: Unpin

impl<R> UnwindSafe for TextReader<R> where
    R: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.