Skip to main content

GenerationStrategy

Trait GenerationStrategy 

Source
pub trait GenerationStrategy {
    // Required method
    fn choose<'p>(
        &mut self,
        production: &'p Production,
        depth: usize,
    ) -> Option<&'p Expression>;
}
Expand description

Strategy for choosing which RHS alternative to use when expanding a nonterminal during grammar sentence generation.

Required Methods§

Source

fn choose<'p>( &mut self, production: &'p Production, depth: usize, ) -> Option<&'p Expression>

Choose one of the production’s RHS alternatives.

Returns Some(&expression) for the chosen alternative, or None if there is no valid choice (e.g. depth-bounded with no terminal-only option).

Implementors§