You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
unidevel
changed the title
allow set existing variable to another type
allow set existing variable with another type
Feb 22, 2024
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?
The text was updated successfully, but these errors were encountered: