pub trait Generator<RuleKeyType: Clone + PartialEq + Debug, GrammarResultType: Clone + PartialEq + Debug, StreamType: Clone + PartialEq + Debug, GrammarType: Grammar<RuleKeyType, GrammarResultType, StreamType>> {
    // Required methods
    fn generate<R: GrammarRandomNumberGenerator>(
        grammar: &GrammarType,
        rng: &mut R
    ) -> Option<StreamType>;
    fn generate_at<R: GrammarRandomNumberGenerator>(
        key: &RuleKeyType,
        grammar: &GrammarType,
        rng: &mut R
    ) -> Option<StreamType>;
    fn expand_from<R: GrammarRandomNumberGenerator>(
        initial: &StreamType,
        grammar: &GrammarType,
        rng: &mut R
    ) -> StreamType;
}
Expand description

This trait represents a stateless generator. You pass the grammar & rng in, and it can provide the resulting stream.

Required Methods§

source

fn generate<R: GrammarRandomNumberGenerator>( grammar: &GrammarType, rng: &mut R ) -> Option<StreamType>

This function generates a new value of StreamType, starting from the grammar’s default rule

source

fn generate_at<R: GrammarRandomNumberGenerator>( key: &RuleKeyType, grammar: &GrammarType, rng: &mut R ) -> Option<StreamType>

This function generates a new value of StreamType, starting from a provided rule key

source

fn expand_from<R: GrammarRandomNumberGenerator>( initial: &StreamType, grammar: &GrammarType, rng: &mut R ) -> StreamType

This function generates a new value of StreamType, starting by processing an initial input of StreamType

Implementors§