12 releases (6 breaking)

0.6.0 May 5, 2020
0.5.3 Apr 28, 2020
0.4.1 Apr 26, 2020
0.3.0 Apr 14, 2020
0.0.2 Mar 18, 2019

#962 in Math

Download history 234/week @ 2025-10-12 425/week @ 2025-10-19 359/week @ 2025-10-26 537/week @ 2025-11-02 324/week @ 2025-11-09 335/week @ 2025-11-16 336/week @ 2025-11-23 554/week @ 2025-11-30 322/week @ 2025-12-07 434/week @ 2025-12-14 378/week @ 2025-12-21 443/week @ 2025-12-28 483/week @ 2026-01-04 511/week @ 2026-01-11 785/week @ 2026-01-18 247/week @ 2026-01-25

2,074 downloads per month
Used in 9 crates (via yarte_hir)

MIT/Apache

75KB
1.5K SLoC

v_eval Documentation Latest version

Expression evaluator with context

use v_eval::{Value, Eval};

fn main() -> Result<(), ()> {
    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));
    
    Ok(())
}

Contributing

Please, contribute to v_eval! The more the better! Feel free to to open an issue and/or contacting directly with the owner for any request or suggestion.

Code of conduct

This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at http://contributor-covenant.org/version/1/4

License

This project is distributed under the terms of both the Apache License (Version 2.0) and the MIT license, specified in LICENSE-APACHE and LICENSE-MIT respectively.

Dependencies

~3.5–4.5MB
~90K SLoC