Expression Evaluation Engine for Rust

A powerful, fast, and memory-efficient expression evaluation engine in Rust.

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 with CustomSimple or CustomAdvanced approaches.

Quick Start

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

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