Trait ParseIt

Source
pub trait ParseIt {
    type Lexer<'a>: Lexer<'a>;
    type Output;

    // Required method
    fn parse_stream(
        &self,
        state: &mut ParserState<Self::Lexer<'_>>,
    ) -> Result<Self::Output, Error>;

    // Provided method
    fn parse(&self, input: &str) -> Result<Self::Output, Error> { ... }
}
Expand description

A parser.

Required Associated Types§

Source

type Lexer<'a>: Lexer<'a>

The lexer type.

Source

type Output

The parser output type.

Required Methods§

Source

fn parse_stream( &self, state: &mut ParserState<Self::Lexer<'_>>, ) -> Result<Self::Output, Error>

Parse from a ParserState.

Provided Methods§

Source

fn parse(&self, input: &str) -> Result<Self::Output, Error>

Parse from a string.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§