evalbit

Crates.ioevalbit
lib.rsevalbit
version0.1.2
created_at2025-10-21 09:24:28.879448+00
updated_at2025-10-22 06:48:15.464952+00
descriptionA simple logical expression evaluation crate with RPN conversion
homepage
repositoryhttps://github.com/Ablaze-MIRAI/evalbit
max_upload_size
id1893551
size18,026
中院ぴあの (Nakanoin19)

documentation

README

evalbit

A simple logical expression evaluation crate with RPN convertion

Crates.io Version

Quickstart

Add evalbit as dependency to your Cargo.toml:

[dependencies]
evalbit = "<desired version>"

Then you can use evalbit to parse and evaluate expressions like this:

use evalbit::*;

let expr = "0 | (1 ^ 2 & 3)"
let rpn = parse(expr);

assert_eq!(rpn.to_string(), "0 1 2 3 & ^ |");
assert_eq!(rpn.exec(&[true, true, false, false]), true);

// and you can directly execute
assert_eq!(eval("0 | (1 ^ 2 & 3)", &[true, true, false, false]), true));

Operators

The operator precedences are equal to Rust's ones.

License

This crate is published under the ISC License.

Commit count: 0

cargo fmt