[−][src]Trait cfg::rule::container::RuleContainer
Trait for rule and symbol containers.
Associated Types
type History
The type of history carried with the rule.
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,
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
.
Provided methods
fn sym<T>(&mut self) -> T where
T: SymbolContainer,
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.
Implementations on Foreign Types
impl<'a, D> RuleContainer for &'a mut D where
D: RuleContainer,
[src]
D: RuleContainer,
type History = D::History
fn sym_source(&self) -> &SymbolSource
[src]
fn sym_source_mut(&mut self) -> &mut SymbolSource
[src]
fn retain<F>(&mut self, f: F) where
F: FnMut(Symbol, &[Symbol], &Self::History) -> bool,
[src]
F: FnMut(Symbol, &[Symbol], &Self::History) -> bool,
fn add_rule(&mut self, lhs: Symbol, rhs: &[Symbol], history: Self::History)
[src]
Implementors
impl RuleContainer for BinarizedGrammar
[src]
type History = History
fn sym_source(&self) -> &SymbolSource
[src]
fn sym_source_mut(&mut self) -> &mut SymbolSource
[src]
fn retain<F>(&mut self, f: F) where
F: FnMut(Symbol, &[Symbol], &History) -> bool,
[src]
F: FnMut(Symbol, &[Symbol], &History) -> bool,
fn add_rule(&mut self, lhs: Symbol, rhs: &[Symbol], history: History)
[src]
impl<H> RuleContainer for BinarizedCfg<H> where
H: Binarize,
[src]
H: Binarize,
type History = H
fn sym_source(&self) -> &SymbolSource
[src]
fn sym_source_mut(&mut self) -> &mut SymbolSource
[src]
fn retain<F>(&mut self, f: F) where
F: FnMut(Symbol, &[Symbol], &Self::History) -> bool,
[src]
F: FnMut(Symbol, &[Symbol], &Self::History) -> bool,
fn add_rule(&mut self, lhs: Symbol, rhs: &[Symbol], history: Self::History)
[src]
impl<H, Hs> RuleContainer for Cfg<H, Hs> where
Hs: Clone + RewriteSequence<Rewritten = H>,
[src]
Hs: Clone + RewriteSequence<Rewritten = H>,