pub fn evaluate_unoptimized<'s, 'e, 'r, R>(
source: &'s str,
args: impl IntoIterator<Item = i32>,
environment: impl IntoIterator<Item = (&'e str, i32)>,
rng: &'r mut R,
) -> Result<Evaluation, EvaluationError<'s>>Expand description
Evaluate the dice expression using the given arguments, environment, and
pseudo-random number generator (pRNG). Missing external variables default
to zero during evaluation, but all parameters must be bound. Do not optimize
the function before evaluation.
This is a one-shot convenience function that compiles and evaluates the
dice expression in a single step. If you need to evaluate the same dice
expression multiple times, consider compiling the function once
and reusing it with the Evaluator type.
§Parameters
source: The source code to compile and evaluate.args: The arguments to the function.environment: The environment in which to evaluate the function, as a vector of external variable bindings. The bindings are pairs of variable names and values. Missing bindings default to zero.rng: The pseudo-random number generator to use for range and dice rolls.
§Returns
The result of the evaluation.
§Errors
CompilationFailedif the function could not be compiled.BadArityif the number of arguments provided disagrees with the number of formal parameters in the function signature.UnrecognizedExternalif an external variable is not recognized.