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

Add dataflow-rs to your Rust project using Cargo.

Requirements

  • Rust 1.85 or later (Edition 2024)
  • Cargo (comes with Rust)

Add to Cargo.toml

[dependencies]
dataflow-rs = "3.12"
serde_json = "1.0"
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }

Cargo Features

All features are off by default; the default build has core JSONLogic only.

FeatureUnlocks
ext-stringlength, starts_with, ends_with, upper, lower, trim, split
ext-arraysort, slice, group_by, distinct
ext-mathabs, ceil, floor
ext-controlexists, ??, switch (alias match), type
ext-objectkeys, values, entries
error-handlingtry, throw (the JSONLogic operators — unrelated to dataflow-rs error handling, which is always on)
datetimedatetime, timestamp, parse_date, format_date, date_diff, now
all-operatorsevery family above
wasm-webrequired when targeting wasm32-unknown-unknown
[dependencies]
dataflow-rs = { version = "3.12", features = ["ext-string"] }

Read JSONLogic → Operator Families before enabling one: turning a family on can change how an existing rule behaves.

Verify Installation

Create a simple test to verify the installation:

use dataflow_rs::Engine;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create an empty rules engine via the builder.
    let engine = Engine::builder().build()?;
    println!("Rules engine created with {} rules", engine.workflows().len());
    Ok(())
}

Run with:

cargo run

You should see:

Rules engine created with 0 rules

Optional Dependencies

Depending on your use case, you may want to add:

[dependencies]
# For async operations
async-trait = "0.1"

# For custom error handling
thiserror = "2.0"

# For logging
log = "0.4"
env_logger = "0.11"

Next Steps