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:

  • extension Support for multiple expression formats through pluggable parsers
  • speed Efficient evaluation with the shared core engine
  • build Easy extension with custom operators while maintaining compatibility

Features

flash_on

Fast & Efficient

Built with Rust for maximum performance and memory efficiency.

integration_instructions

WebAssembly Ready

Use in browsers with WASM compilation support.

code

Comprehensive

Supports JSONLogic and extensible for more expression formats.

extension

Extensible

Add custom operators for your specific needs.

Quick Start

Import the crate:
[dependencies]
datalogic-rs = "3.0.7"
Example usage:
// 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"
}

Operator Categories

calculate

Arithmetic

+, -, *, /, %, etc.

arrow_forward
compare_arrows

Comparison

==, !=, >, <, >=, <=, etc.

arrow_forward
view_array

Array

map, filter, reduce, some, all, etc.

arrow_forward
text_format

String

cat, substr, etc.

arrow_forward
tune

Variables

var, missing, etc.

arrow_forward
account_tree

Control Flow

if, ?, try, etc.

arrow_forward