Trait RuleSelector

Source
pub trait RuleSelector<Nt, T> {
    // Required method
    fn select_matching_rule<'a>(
        &self,
        matching_rules: &[&'a Rule<Nt, T>],
    ) -> Option<&'a Rule<Nt, T>>;

    // Provided methods
    fn select_rule<'a>(
        &self,
        all_rules: &'a [Rule<Nt, T>],
        nonterm_value: &Nt,
    ) -> Option<&'a Rule<Nt, T>>
       where Nt: NonterminalValue { ... }
    fn find_matching_rules<'a>(
        &self,
        all_rules: &'a [Rule<Nt, T>],
        nonterm_value: &Nt,
    ) -> Vec<&'a Rule<Nt, T>>
       where Nt: NonterminalValue { ... }
}
Expand description

Implement this trait if you want to provide custom rule selection logic.

See crate docs for an example.

Required Methods§

Source

fn select_matching_rule<'a>( &self, matching_rules: &[&'a Rule<Nt, T>], ) -> Option<&'a Rule<Nt, T>>

Provided Methods§

Source

fn select_rule<'a>( &self, all_rules: &'a [Rule<Nt, T>], nonterm_value: &Nt, ) -> Option<&'a Rule<Nt, T>>
where Nt: NonterminalValue,

Source

fn find_matching_rules<'a>( &self, all_rules: &'a [Rule<Nt, T>], nonterm_value: &Nt, ) -> Vec<&'a Rule<Nt, T>>
where Nt: NonterminalValue,

Implementors§