Expression Evaluation Engine for Rust
A powerful, fast, and memory-efficient expression evaluation engine in Rust.
Architecture
DataLogic-rs features a modular design where parsers can be added as plugins while the core evaluation engine remains the same.
JSONLogic Parser
Custom Parser
Future Parsers
↓
Abstract Syntax Tree (AST)
↓
Expression Evaluation Core
↓
Arithmetic
Comparison
Array
String
This layered architecture enables:
- Support for multiple expression formats through pluggable parsers
- Efficient evaluation with the shared core engine
- Easy extension with custom operators while maintaining compatibility
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 for your specific needs.
Quick Start
Import the crate:[dependencies]
datalogic-rs = "3.0.7"
// In your Rust code
use datalogic_rs::DataLogic;
fn main() {
let dl = DataLogic::new();
// Parse and evaluate in one step
let result = dl
.evaluate_str(
r#"{ "some": [{"var": "items"}, {">=": [{"var": "qty"}, 1]}] }"#,
r#"{"items": [{"qty": 1, "id": "first"}, {"qty": 2, "id": "second"}]}"#,
None,
)
.unwrap();
println!("Result: {}", result); // prints "true"
}