[−][src]Function evalexpr::eval_with_context
pub fn eval_with_context(
string: &str,
context: &dyn Context
) -> EvalexprResult<Value>
Evaluate the given expression string with the given context.
Examples
use evalexpr::*; let mut context = HashMapContext::new(); context.set_value("one", 1).unwrap(); // Do proper error handling here context.set_value("two", 2).unwrap(); // Do proper error handling here context.set_value("three", 3).unwrap(); // Do proper error handling here assert_eq!(eval_with_context("one + two + three", &context), Ok(Value::from(6)));
See the crate doc for more examples and explanations of the expression format.