Trait from_pest::FromPest

source ·
pub trait FromPest<'pest>: Sized {
    type Rule: RuleType;
    type FatalError;

    fn from_pest(
        pest: &mut Pairs<'pest, Self::Rule>
    ) -> Result<Self, ConversionError<Self::FatalError>>; }
Expand description

Potentially borrowing conversion from a pest parse tree.

Required Associated Types

The rule type for the parse tree this type corresponds to.

A fatal error during conversion.

Required Methods

Convert from a Pest parse tree.

Return type semantics
  • Err(ConversionError::NoMatch) => node not at head of the cursor, cursor unchanged
  • Err(ConversionError::Malformed) => fatal error; node at head of the cursor but malformed
  • Ok => success; the cursor has been updated past this node

Implementations on Foreign Types

Convert a production without storing it.

For recursive grammars.

Convert an optional production.

Convert many productions. (If <T as FromPest> is non-advancing, this will be non-terminating.)

Consume a production without doing any processing.

Implementors