pub struct Evaluator { /* private fields */ }Implementations§
source§impl Evaluator
impl Evaluator
sourcepub fn new(context: HashMap<String, Value>) -> Self
pub fn new(context: HashMap<String, Value>) -> Self
Examples found in repository?
examples/basic.rs (line 16)
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
fn main() -> Result<(), Box<dyn Error>>{
#[cfg(feature = "logging")]
let logger = scribe_rust::Logger::default();
let mut ctx = HashMap::new();
ctx.insert("x".to_string(), serde_json::Value::Number(5.into()));
let engine = exprimo::Evaluator::new(ctx, #[cfg(feature = "logging")] logger);
let result = engine.evaluate("x == 0")?;
println!("x = {}", result);
Ok(())
}sourcepub fn evaluate(&self, expression: &str) -> Result<bool, Box<dyn Error>>
pub fn evaluate(&self, expression: &str) -> Result<bool, Box<dyn Error>>
Examples found in repository?
examples/basic.rs (line 18)
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
fn main() -> Result<(), Box<dyn Error>>{
#[cfg(feature = "logging")]
let logger = scribe_rust::Logger::default();
let mut ctx = HashMap::new();
ctx.insert("x".to_string(), serde_json::Value::Number(5.into()));
let engine = exprimo::Evaluator::new(ctx, #[cfg(feature = "logging")] logger);
let result = engine.evaluate("x == 0")?;
println!("x = {}", result);
Ok(())
}Auto Trait Implementations§
impl RefUnwindSafe for Evaluator
impl Send for Evaluator
impl Sync for Evaluator
impl Unpin for Evaluator
impl UnwindSafe for Evaluator
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more