I'm using this to eval expr for a table. I want to set the current value as "$$", but the types of columns are different, when I use set_value from the context, it give error like Err(ExpectedInt { actual: String("test") }) when I try to set a string to an existing variable with value of int.
The test code is:
use evalexpr::{eval_with_context, ContextWithMutableVariables, HashMapContext, Value};
fn main() {
let mut ctx = HashMapContext::new();
let r1 = ctx.set_value("$$".into(), Value::from(123));
let r2 = ctx.set_value("$$".into(), Value::from("test"));
let r = eval_with_context("$$+1", &ctx);
println!("result: {:?}, {:?}, {:?}", r1, r2, r);
}
Can you add a function to clear the variable or allow set_value with new type?
I'm using this to eval expr for a table. I want to set the current value as "$$", but the types of columns are different, when I use set_value from the context, it give error like
Err(ExpectedInt { actual: String("test") })
when I try to set a string to an existing variable with value of int.The test code is:
Can you add a function to clear the variable or allow set_value with new type?