[][src]Crate v_eval

Evaluate some syn::Expr with context

use v_eval::{Value, Eval};

let e = Eval::default()
    .insert("foo", "true")?
    .insert("bar", "false")?;

assert_eq!(e.eval("foo != bar").unwrap(), Value::Bool(true));
assert_eq!(
    e.eval("true && foo != bar && true").unwrap(),
    Value::Bool(true)
);
assert_eq!(e.eval("1 == 1 != bar").unwrap(), Value::Bool(true));
assert_eq!(e.eval("1 == 1 + 1 == bar").unwrap(), Value::Bool(true));

Structs

Eval

Evaluator with context

Enums

Value

Wrapper for value implements simple operations and check types

Functions

eval