File: ns_btreemap_str.rs

package info (click to toggle)
rust-fasteval 0.2.4-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 952 kB
  • sloc: python: 14; makefile: 8
file content (12 lines) | stat: -rw-r--r-- 323 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
// usage:  cargo run --release --example ns_btreemap_str

use std::collections::BTreeMap;
fn main() -> Result<(), fasteval::Error> {
    let mut map : BTreeMap<&'static str,f64> = BTreeMap::new();
    map.insert("x", 2.0);

    let val = fasteval::ez_eval("x * (x + 1)", &mut map)?;
    assert_eq!(val, 6.0);

    Ok(())
}