Trait fastobo::parser::Parser[][src]

pub trait Parser<B: BufRead>: From<B> + Iterator<Item = Result<Frame, Error>> + AsRef<B> + AsMut<B> {
    fn into_inner(self) -> B;

    fn new(stream: B) -> Self { ... }
fn with_threads(stream: B, threads: NonZeroUsize) -> Self { ... }
fn ordered(&mut self, ordered: bool) -> &mut Self { ... } }

The common interface for OBO parsers.

Required methods

fn into_inner(self) -> B[src]

Extract the internal buffered reader from the parser.

Loading content...

Provided methods

fn new(stream: B) -> Self[src]

Create a new Parser reading from the reader.

fn with_threads(stream: B, threads: NonZeroUsize) -> Self[src]

Create a new Parser with the given number of threads.

If multithreading is not supported by the parser, this method will default to Self::new.

fn ordered(&mut self, ordered: bool) -> &mut Self[src]

Force the parser to yield frames in the order they appear in the document.

Since this can have a small performance impact, parser are expected not to care about frame order by default unless forced to by this method.

Loading content...

Implementations on Foreign Types

impl<B: BufRead> Parser<B> for Box<SequentialParser<B>>[src]

impl<B: BufRead> Parser<B> for Box<ThreadedParser<B>>[src]

Loading content...

Implementors

impl<B: BufRead> Parser<B> for SequentialParser<B>[src]

fn new(stream: B) -> Self[src]

Create a new SequentialParser from the given stream.

The constructor will parse the header frame right away, and return an error if it fails. The header can then be accessed using the header method.

fn ordered(&mut self, _ordered: bool) -> &mut Self[src]

Make the parser yield frames in the order they appear in the document.

This has no effect on SequentialParser since the frames are always processed in the document order, but this method is provided for consistency of the FrameReader type.

fn into_inner(self) -> B[src]

Consume the reader and extract the internal reader.

impl<B: BufRead> Parser<B> for ThreadedParser<B>[src]

fn new(stream: B) -> Self[src]

Create a new ThreadedParser with all available CPUs.

The number of available CPUs will be polled at runtime and then the right number of threads will be spawned accordingly.

fn with_threads(stream: B, threads: NonZeroUsize) -> Self[src]

Create a new ThreadedParser with the given number of threads.

fn ordered(&mut self, ordered: bool) -> &mut Self[src]

Make the parser yield frames in the order they appear in the document.

Note that this has a small performance impact, so this is disabled by default.

fn into_inner(self) -> B[src]

Consume the reader and extract the internal reader.

Loading content...