Expression Evaluation Engine for Rust
A powerful, fast, and memory-efficient expression evaluation engine in Rust.
Features
Fast & Efficient
Built with Rust for maximum performance and memory efficiency.
WebAssembly Ready
Use in browsers with WASM compilation support.
Comprehensive
Supports JSONLogic and extensible for more expression formats.
Extensible
Add custom operators with CustomSimple or CustomAdvanced approaches.
Quick Start
Import the crate:[dependencies]
datalogic-rs = "3.0.12"
// In your Rust code
use datalogic_rs::DataLogic;
fn main() {
let dl = DataLogic::new();
// Method 1: Parse and evaluate in one step with evaluate_str
let result1 = dl
.evaluate_str(
r#"{ "some": [{"var": "items"}, {">=": [{"var": "qty"}, 1]}] }"#,
r#"{"items": [{"qty": 1, "id": "first"}, {"qty": 2, "id": "second"}]}"#,
None,
)
.unwrap();
println!("Result1: {}", result1); // prints "true"
// Method 2: Use the evaluate_str method for one-step evaluation
let result2 = dl
.evaluate_str(
r#"{ "abs": -42 }"#,
r#"{}"#,
None,
)
.unwrap();
println!("Result2: {}", result2); // prints "42"
}