Trait parser_combinators::Parser [] [src]

pub trait Parser {
    type Input: Stream;
    type Output;
    fn parse_state(&mut self, input: State<Self::Input>) -> ParseResult<Self::Output, Self::Input>;

    fn parse(&mut self, input: Self::Input) -> Result<(Self::Output, Self::Input)ParseError> { ... }
}

By implementing the Parser trait a type says that it can be used to parse an input stream into the type Output.

Associated Types

type Input: Stream

A type implementing the Stream trait which is the specific type that is parsed.

type Output

The type which is returned when the parsing is successful.

Required Methods

fn parse_state(&mut self, input: State<Self::Input>) -> ParseResult<Self::Output, Self::Input>

Parses using the state input by calling Stream::uncons one or more times On success returns Ok((value, new_state)) on failure it returns Err(error)

Provided Methods

fn parse(&mut self, input: Self::Input) -> Result<(Self::Output, Self::Input)ParseError>

Entrypoint of the parser Takes some input and tries to parse it returning a ParseResult

Implementors