Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Installation

Adding to Your Project

Add datalogic-rs to your Cargo.toml:

[dependencies]
datalogic-rs = "5.0"

Or use cargo add:

cargo add datalogic-rs

Note: v5 does not require serde_json by default — the canonical entry points (Engine::eval_str, Engine::compile(&str), datalogic_rs::eval_str) are string-based. Add the serde_json feature only if you need serde_json::Value interop or the typed eval_into::<T> paths.

Feature Flags

v5 splits the surface into a small core plus opt-in features:

FeatureDefaultWhat it adds
serde_jsonoff&serde_json::Value interop (as EvalInput / IntoLogic) and the typed eval_into::<T> paths on Engine, Session, and the module-level helpers. Pulls in serde_json as a runtime dependency.
templatingoffTemplating mode — Engine::builder().with_templating(true).build().
datetimeoffdatetime, timestamp, parse_date, format_date, date_diff, now operators (pulls in chrono).
traceoffPer-evaluation execution tracing (engine.trace()…). Transitively enables serde_json.
ext-stringoffExtended string operators.
ext-arrayoffExtended array operators (e.g. sort).
ext-controloffExtended control-flow operators (e.g. inspect).
error-handlingofftry / throw operators.
ext-mathoffExtended math operators.
flagdoffOpenFeature flagd-compatible fractional (murmurhash3 percentage bucketing) and sem_ver (semantic-version comparison) operators.
wasmoffBundle convenience for WASM builds (= datetime + trace + templating).

Example — opt into serde_json::Value interop plus templating:

[dependencies]
datalogic-rs = { version = "5.0", features = ["serde_json", "templating"] }
serde_json = "1.0"

Version Selection

  • v5.x (current): canonical string-based API, opt-in serde_json, builder-only operator registration. v5 is a hard cliff — no compat shim — so plan a single cutover.
  • v4.x: DataLogic engine, serde_json::Value-first API. Still functional but no longer the active line.
  • v3.x: Arena-based allocation, predates the v4 simplification. Bug-fix only.

If you’re upgrading from v4, see the Migration Guide.

Other languages

The Rust crate is the engine; every other language uses its own binding. Click through to the binding’s README for install instructions and the language-idiomatic API:

LanguagePackageInstallDeep-dive
Node.js (native, napi-rs)@goplasmatic/datalogic-nodenpm i @goplasmatic/datalogic-nodebindings/node/README.md
JavaScript / TypeScript (WASM)@goplasmatic/datalogic-wasmnpm i @goplasmatic/datalogic-wasmbindings/wasm/README.md
Pythondatalogic-pypip install datalogic-pybindings/python/README.md
Godatalogic-gogo get github.com/GoPlasmatic/datalogic-rs/bindings/go/v5bindings/go/README.md
JVM (Java, Kotlin, Scala)io.github.goplasmatic:datalogicMaven Central dependencybindings/jvm/README.md
.NETGoplasmatic.Datalogicdotnet add package Goplasmatic.Datalogicbindings/dotnet/README.md
PHPgoplasmatic/datalogiccomposer require goplasmatic/datalogicbindings/php/README.md
React (visual debugger)@goplasmatic/datalogic-uinpm i @goplasmatic/datalogic-uiui/README.md

Building the WASM binding from source:

cd bindings/wasm
./build.sh

Minimum Rust Version

datalogic-rs v5 uses Rust edition 2024 — Rust 1.85 or later is required. The crate is built with #![forbid(unsafe_code)].

Verifying Installation

Create a simple test:

fn main() {
    let result = datalogic_rs::eval_str(r#"{"+": [1, 2]}"#, r#"{}"#).unwrap();

    println!("1 + 2 = {}", result);
    assert_eq!(result, "3");
}

Run with:

cargo run

You should see: 1 + 2 = 3