Trait Parser

Source
pub trait Parser {
    type Output: Clone;
    type PartialState: Clone;

    // Required method
    fn parse<'a>(
        &self,
        state: &Self::PartialState,
        input: &'a [u8],
    ) -> ParseResult<ParseStatus<'a, Self::PartialState, Self::Output>>;
}
Expand description

An incremental parser for a structured input.

Required Associated Types§

Source

type Output: Clone

The output of the parser.

Source

type PartialState: Clone

The state of the parser.

Required Methods§

Source

fn parse<'a>( &self, state: &Self::PartialState, input: &'a [u8], ) -> ParseResult<ParseStatus<'a, Self::PartialState, Self::Output>>

Parse the given input.

Implementations on Foreign Types§

Source§

impl Parser for ()

Source§

type Output = ()

Source§

type PartialState = ()

Source§

fn parse<'a>( &self, _state: &Self::PartialState, input: &'a [u8], ) -> ParseResult<ParseStatus<'a, Self::PartialState, Self::Output>>

Source§

impl<P: ?Sized + Parser> Parser for &P

Source§

type Output = <P as Parser>::Output

Source§

type PartialState = <P as Parser>::PartialState

Source§

fn parse<'a>( &self, state: &Self::PartialState, input: &'a [u8], ) -> ParseResult<ParseStatus<'a, Self::PartialState, Self::Output>>

Source§

impl<P: ?Sized + Parser> Parser for Box<P>

Source§

type Output = <P as Parser>::Output

Source§

type PartialState = <P as Parser>::PartialState

Source§

fn parse<'a>( &self, state: &Self::PartialState, input: &'a [u8], ) -> ParseResult<ParseStatus<'a, Self::PartialState, Self::Output>>

Source§

impl<P: ?Sized + Parser> Parser for Arc<P>

Source§

type Output = <P as Parser>::Output

Source§

type PartialState = <P as Parser>::PartialState

Source§

fn parse<'a>( &self, state: &Self::PartialState, input: &'a [u8], ) -> ParseResult<ParseStatus<'a, Self::PartialState, Self::Output>>

Implementors§

Source§

impl Parser for StructureParser

Source§

impl Parser for FloatParser

Source§

impl Parser for I8Parser

Source§

impl Parser for I16Parser

Source§

impl Parser for I32Parser

Source§

impl Parser for I64Parser

Source§

impl Parser for IntegerParser

Source§

impl Parser for LiteralParser

Source§

impl Parser for RegexParser

Source§

impl Parser for U8Parser

Source§

impl Parser for U16Parser

Source§

impl Parser for U32Parser

Source§

impl Parser for U64Parser

Source§

impl<F: Fn(char) -> bool + 'static> Parser for StringParser<F>

Source§

impl<O, PA, P: Parser<Output = O, PartialState = PA> + CreateParserState> Parser for RepeatParser<P>
where P::PartialState: Clone, P::Output: Clone,

Source§

impl<O: Clone> Parser for ArcParser<O>

Source§

impl<P1: Parser, P2: CreateParserState> Parser for SequenceParser<P1, P2>

Source§

impl<P1: Parser, P2: CreateParserState, F: Fn(&P1::Output) -> P2> Parser for ThenLazy<P1, F>

Source§

impl<P1: Parser, P2: Parser> Parser for ChoiceParser<P1, P2>

Source§

impl<P: CreateParserState, S: CreateParserState> Parser for SeparatedParser<P, S>

Source§

impl<P: Parser, F: Fn() -> P::PartialState + Clone> Parser for WithInitialState<P, F>

Source§

impl<P: Parser, F: FnOnce() -> P> Parser for LazyParser<P, F>

Source§

impl<P: Parser, O: Clone, F: Fn(P::Output) -> O> Parser for MapOutputParser<P, O, F>

Source§

impl<S: AsRef<str>, F: Fn(char) -> bool + 'static> Parser for StopOn<S, F>

Source§

impl<const MIN_LENGTH: usize, const MAX_LENGTH: usize> Parser for SentenceParser<MIN_LENGTH, MAX_LENGTH>

Source§

type Output = Sentence<MIN_LENGTH, MAX_LENGTH>

Source§

type PartialState = <StringParser as Parser>::PartialState

Source§

impl<const MIN_LENGTH: usize, const MAX_LENGTH: usize> Parser for WordParser<MIN_LENGTH, MAX_LENGTH>

Source§

type Output = Word<MIN_LENGTH, MAX_LENGTH>

Source§

type PartialState = <StringParser as Parser>::PartialState