Installation
Adding to Your Project
Select your target language to see package installation instructions:
// Cargo.toml
[dependencies]
datalogic-rs = "5.1"
Or run in terminal:
cargo add datalogic-rs
// npm
npm install @goplasmatic/datalogic-node # for Node.js services (native FFI)
# or:
npm install @goplasmatic/datalogic-wasm # for Browsers / Bun / Workers (WASM)
# pip
pip install datalogic-py
// go.mod
go get github.com/GoPlasmatic/datalogic-rs/bindings/go/v5
// Maven: pom.xml
<dependency>
<groupId>io.github.goplasmatic</groupId>
<artifactId>datalogic</artifactId>
<version>5.1.0</version>
</dependency>
// Gradle: build.gradle.kts
implementation("io.github.goplasmatic:datalogic:5.1.0")
// dotnet CLI
dotnet add package Goplasmatic.Datalogic
// Composer
composer require goplasmatic/datalogic
Note for Rust users: v5 does not require
serde_jsonby default — the canonical entry points (Engine::eval_str,Engine::compile(&str),datalogic_rs::eval_str) are string-based. Add theserde_jsonfeature only if you needserde_json::Valueinterop or the typedeval_into::<T>paths.
Feature Flags
v5 splits the surface into a small core plus opt-in features:
| Feature | Default | What it adds |
|---|---|---|
serde_json | off | &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. |
templating | off | Templating mode — Engine::builder().with_templating(true).build(). |
datetime | off | datetime, timestamp, parse_date, format_date, date_diff, now operators (pulls in chrono). |
trace | off | Per-evaluation execution tracing (engine.trace()…). Transitively enables serde_json. |
ext-string | off | Extended string operators. |
ext-array | off | Extended array operators (e.g. sort). |
ext-control | off | Extended control-flow operators (exists, ??, switch/match, type). |
error-handling | off | try / throw operators. |
ext-math | off | Extended math operators. |
flagd | off | OpenFeature flagd-compatible fractional (murmurhash3 percentage bucketing) and sem_ver (semantic-version comparison) operators. |
wasm-clock | off | JS-host clock for the now operator on wasm32-unknown-unknown (browsers, Node, Deno, Workers); combine with datetime. Opt-in on purpose: it forwards to chrono/wasmbind, whose JS imports fail to instantiate in non-JS wasm runtimes such as wasmtime, wazero, and Chicory — leave it off there (on WASI the OS clock works without it). |
Example — opt into serde_json::Value interop plus templating:
[dependencies]
datalogic-rs = { version = "5.1", 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 — nocompatshim — so plan a single cutover. - v4.x:
DataLogicengine,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 guide for install instructions and the language-idiomatic API:
| Language | Package | Install | Deep-dive |
|---|---|---|---|
| Node.js (native, napi-rs) | @goplasmatic/datalogic-node | npm i @goplasmatic/datalogic-node | Node native README |
| JavaScript / TypeScript (WASM) | @goplasmatic/datalogic-wasm | npm i @goplasmatic/datalogic-wasm | JS / TS docs |
| Python | datalogic-py | pip install datalogic-py | Python docs |
| Go | datalogic-go | go get github.com/GoPlasmatic/datalogic-rs/bindings/go/v5 | Go docs |
| JVM (Java, Kotlin, Scala) | io.github.goplasmatic:datalogic | Maven Central dependency | Java / Kotlin docs |
| .NET | Goplasmatic.Datalogic | dotnet add package Goplasmatic.Datalogic | .NET docs |
| PHP | goplasmatic/datalogic | composer require goplasmatic/datalogic | PHP docs |
| React (visual debugger) | @goplasmatic/datalogic-ui | npm i @goplasmatic/datalogic-ui | React docs |
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 script or test file to verify everything works:
// main.rs
fn main() {
let result = datalogic_rs::eval_str(r#"{"+": [1, 2]}"#, r#"{}"#).unwrap();
println!("1 + 2 = {}", result);
assert_eq!(result, "3");
}
// Run in terminal: cargo run
// index.js
import { apply } from '@goplasmatic/datalogic-node';
const result = apply({ '+': [1, 2] }, {});
console.log(`1 + 2 = ${result}`); // 1 + 2 = 3
// browser/edge: same API via @goplasmatic/datalogic-wasm, see the WASM chapter
# test.py
from datalogic_py import apply
result = apply({"+": [1, 2]}, {})
print(f"1 + 2 = {result}") # 1 + 2 = 3.0
// main.go
package main
import (
"fmt"
datalogic "github.com/GoPlasmatic/datalogic-rs/bindings/go/v5"
)
func main() {
result, _ := datalogic.Apply(`{"+": [1, 2]}`, `{}`)
fmt.Printf("1 + 2 = %s\n", result) // 1 + 2 = 3
}
// Main.java
import com.goplasmatic.datalogic.Engine;
public class Main {
public static void main(String[] args) {
try (Engine engine = new Engine()) {
String result = engine.apply("{\"+\": [1, 2]}", "{}");
System.out.println("1 + 2 = " + result); // 1 + 2 = 3
}
}
}
// Program.cs
using Goplasmatic.Datalogic;
using var engine = new Engine();
var result = engine.Apply("""{"+": [1, 2]}""", "{}");
Console.WriteLine($"1 + 2 = {result}"); // 1 + 2 = 3
<?php // test.php
require 'vendor/autoload.php';
use Goplasmatic\Datalogic\Engine;
$engine = new Engine();
echo "1 + 2 = " . $engine->apply('{"+": [1, 2]}', '{}'); // 1 + 2 = 3