[][src]Trait cfg::rule::container::RuleContainer

pub trait RuleContainer {
    type History;
    fn sym_source(&self) -> &SymbolSource;
fn sym_source_mut(&mut self) -> &mut SymbolSource;
fn retain<F>(&mut self, f: F)
    where
        F: FnMut(Symbol, &[Symbol], &Self::History) -> bool
;
fn add_rule(&mut self, lhs: Symbol, rhs: &[Symbol], history: Self::History); fn sym<T>(&mut self) -> T
    where
        T: SymbolContainer
, { ... }
fn next_sym(&mut self) -> Symbol { ... }
fn num_syms(&self) -> usize { ... } }

Trait for rule and symbol containers.

Associated Types

type History

The type of history carried with the rule.

Loading content...

Required methods

fn sym_source(&self) -> &SymbolSource

Returns an immutable reference to the grammar's symbol source.

fn sym_source_mut(&mut self) -> &mut SymbolSource

Returns a mutable reference to the grammar's symbol source.

fn retain<F>(&mut self, f: F) where
    F: FnMut(Symbol, &[Symbol], &Self::History) -> bool

Retains only the rules specified by the predicate.

In other words, removes all rules rule for which f(&rule) returns false.

fn add_rule(&mut self, lhs: Symbol, rhs: &[Symbol], history: Self::History)

Inserts a rule with lhs and rhs on its LHS and RHS. The rule carries history.

Loading content...

Provided methods

fn sym<T>(&mut self) -> T where
    T: SymbolContainer

Returns generated symbols.

fn next_sym(&mut self) -> Symbol

Generates a new unique symbol.

fn num_syms(&self) -> usize

Returns the number of symbols in use.

Loading content...

Implementations on Foreign Types

impl<'a, D> RuleContainer for &'a mut D where
    D: RuleContainer
[src]

type History = D::History

Loading content...

Implementors

impl RuleContainer for BinarizedGrammar[src]

type History = History

impl<H> RuleContainer for BinarizedCfg<H> where
    H: Binarize
[src]

type History = H

impl<H, Hs> RuleContainer for Cfg<H, Hs> where
    Hs: Clone + RewriteSequence<Rewritten = H>, 
[src]

type History = H

Loading content...