pub trait FromPair<'i>: Sized {
    const RULE: Rule;

    unsafe fn from_pair_unchecked(
        pair: Pair<'i, Rule>,
        cache: &Cache
    ) -> Result<Self, SyntaxError>; fn from_pair(
        pair: Pair<'i, Rule>,
        cache: &Cache
    ) -> Result<Self, SyntaxError> { ... } }
Expand description

A trait for structures that can be parsed from a pest::Pair.

Associated Constants

The production rule the pair is expected to be obtained from.

Required methods

Create a new instance from a Pair without checking the rule.

Safety

May panic if the pair was not produced by the right rule, i.e. pair.as_rule() != <Self as FromPair>::RULE.

Provided methods

Create a new instance from a Pair.

Implementations on Foreign Types

Implementors