create_function

Function create_function 

Source
pub fn create_function(
    input: &str,
) -> Result<impl Fn(&[(&str, f64)]) -> Result<f64, String>, String>
Expand description

Creates a function from a string expression.

ยงExamples

use expression_parser::create_function;

let f = create_function("x^2 + y").unwrap();

let result = f(&[("x", 3.0), ("y", 1.0)]).unwrap();
assert_eq!(result, 10.0);