[][src]Struct gchemol_parser::TextReader

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

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]

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. 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 partitions<P>(self, p: P) -> Partitions<R, P> where
    P: ReadPart
[src]

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]

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]

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

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.