pub fn calculate(input_str: &str, ctx: &mut Context) -> Result<f64, CalcError>Expand description
Attempts to calculate a string containing a mathematical expression
On top of the input string, this function also takes a mutable reference to
a Context object, this object is used to keep track of state between calls,
tracking things like user-defined variables and previous answers. Returns a
result containing the solution to the expression if successful, or a CalcError
struct if not.
§Example
assert_eq!(calculate("5 + 5", &mut ctx), Ok(10.0));