Add the Dependency
Add the GoRules engine to your Cargo.toml.
cargo add zen-engineLoad a Decision
Create an engine and load your decision graph.
use zen_engine::DecisionEngine;
use zen_engine::model::DecisionContent;
let content: DecisionContent = serde_json::from_str(
include_str!("./decision.json")
)?;
let engine = DecisionEngine::default();
let decision = engine.create_decision(content.into());Evaluate Rules
Pass your input data and receive the decision result.
use serde_json::json;
let result = decision.evaluate(&json!({
"customer": { "tier": "premium", "country": "US" },
"cart": { "total": 150, "items": 3 }
})).await?;
println!("{:?}", result.result); // {"discount": 15, "freeShipping": true}Why Rust?
Built for performance and developer experience
Zero-Cost Abstractions
Pure Rust implementation with no runtime overhead. Compile-time optimizations for maximum speed.
Async Runtime
Built on Tokio for efficient async execution. Perfect for high-throughput applications.
Memory Safe
Rust's ownership model guarantees memory safety without garbage collection pauses.
About the Rust SDK
The GoRules Rust SDK is the foundation of our entire ecosystem. Written in pure Rust, it provides the highest possible performance for business rule evaluation with zero-cost abstractions and compile-time optimizations.
The engine leverages Rust's ownership model for guaranteed memory safety without garbage collection pauses. Built on Tokio, it supports efficient async execution for I/O-bound operations while maintaining blazing-fast synchronous evaluation for pure rule processing.
This is the same engine that powers all our other language SDKs through native bindings. For applications where every microsecond counts, or when you want maximum control over the rule evaluation process, the Rust SDK delivers uncompromising performance.