[][src]Function evalexpr::eval_with_configuration

pub fn eval_with_configuration(
    string: &str,
    configuration: &dyn Configuration
) -> Result<Value, Error>

Evaluate the given expression string with the given configuration.

Examples

use evalexpr::*;

let mut configuration = HashMapConfiguration::new();
configuration.insert_variable("one", 1);
configuration.insert_variable("two", 2);
configuration.insert_variable("three", 3);
assert_eq!(eval_with_configuration("one + two + three", &configuration), Ok(Value::from(6)));

See the crate doc for more examples and explanations of the expression format.