mathew 0.0.2

Mathematical expression evaluator with context
Documentation
  • Coverage
  • 66.67%
    6 out of 9 items documented1 out of 7 items with examples
  • Size
  • Source code size: 38.24 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.9 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 18s Average build duration of successful builds.
  • all releases: 18s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • tizgafa zzau13

mathew Documentation Latest version

Mathematical expression evaluator with context and float methods

use mathew::Eval;

fn main() -> Result<(), ()> {
    let e = Eval::default().insert("foo", "1")?.insert("bar", "0")?;

    assert_eq!(e.eval("foo + bar").unwrap(), 1.0);
    
    assert_eq!(e.eval("foo - bar * 1").unwrap(), 1.0);
    
    assert_eq!(e.eval("1 + bar").unwrap(), 1.0);
    
    assert_eq!(e.eval("2.5.powi(2 * foo)").unwrap(), 6.25);

    Ok(())
}

Contributing

Please, contribute to mathew! 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.

Support

Patreon