Trait bevy_generative_grammars::generator::Generator
source · 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§
sourcefn generate<R: GrammarRandomNumberGenerator>(
grammar: &GrammarType,
rng: &mut R
) -> Option<StreamType>
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
sourcefn generate_at<R: GrammarRandomNumberGenerator>(
key: &RuleKeyType,
grammar: &GrammarType,
rng: &mut R
) -> Option<StreamType>
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
sourcefn expand_from<R: GrammarRandomNumberGenerator>(
initial: &StreamType,
grammar: &GrammarType,
rng: &mut R
) -> StreamType
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