Trait Parsing

Source
pub trait Parsing<P> {
    // Required methods
    fn run(&self, input: &str) -> Result<P>;
    fn name(&self) -> &'static str;
}
Expand description

Container for a parsing function.

The contained function transforms the input file into a better usable structure.

Allows to have both failable and infailable parsers, respective Parser and FailableParser (where the function type is a result).

Required Methods§

Source

fn run(&self, input: &str) -> Result<P>

Transforms the file input into a better usable structure.

Source

fn name(&self) -> &'static str

The name of the parsing function.

Implementors§

Source§

impl<F, P> Parsing<P> for FailableParser<F, P>
where F: Fn(&str) -> Result<P>,

Source§

impl<F, P> Parsing<P> for Parser<F, P>
where F: Fn(&str) -> P,