Skip to main content

eval_with_functions

Function eval_with_functions 

Source
pub fn eval_with_functions(
    engine: &Engine,
    formula: &str,
    custom_ast: Option<&AST>,
) -> Result<Dynamic, String>
Expand description

Evaluate a formula, optionally with custom functions AST.

When custom functions are present, we need both the AST and the original script to properly evaluate closures. Closures need access to registered functions, which works better when evaluating as a script rather than merged ASTs.