Introduction
rust-runes is a rule engine for embedding business logic in Rust applications. It is
compatible with Grule’s rule
language (GRL) and execution model: Grule’s .grl files load unchanged and fire the same
rules.
Rules state what to do when a condition holds:
rule LongRide "Long rides get a flat rate" salience 10 {
when
Ride.Distance > 5000 && !Ride.Priced
then
Ride.NetAmount = 143.32;
Ride.Priced = true;
}
Your application keeps the rules outside its code, hands the engine some facts (usually its own serde types), and the engine runs the rules until none applies.
This guide covers:
- Getting started: loading rules and running them against your types.
- Facts: how Rust values become facts and back.
- The rule language and the built-in functions.
- The execution model: which rules fire, in what order, and how often.
- Your own functions and methods, callable from rules.
- Migrating from Grule: the Go API side by side, and the differences.
- Performance: benchmarks against Grule’s.
The API documentation describes every type and method.
rust-runes is an independent implementation; it is not affiliated with the Grule project.