sophia_api::parser

Trait QuadParser

Source
pub trait QuadParser<T> {
    type Source: QuadSource;

    // Required method
    fn parse(&self, data: T) -> Self::Source;

    // Provided method
    fn parse_str<'t>(&self, txt: &'t str) -> Self::Source
       where &'t str: IntoParsable<Target = T> { ... }
}
Expand description

A parser takes some data of type T, and returns a QuadSource.

Required Associated Types§

Source

type Source: QuadSource

The source produced by this parser

Required Methods§

Source

fn parse(&self, data: T) -> Self::Source

Parses data into a quad source.

Provided Methods§

Source

fn parse_str<'t>(&self, txt: &'t str) -> Self::Source
where &'t str: IntoParsable<Target = T>,

Convenient shortcut method for parsing strings.

It may not be available on some exotic parsers, but will be automatically supported for parsers supporting any BufRead or Read.

Implementors§