Dynarule 🚀
A flexible, JSON-based rule engine for Rust, designed for dynamic condition evaluation. Supports nested conditions, custom functions, rule priorities, dynamic updates, and templated outcomes using Tera.
✨ Features
- ⚡️ Define rules in JSON
- 🔍 Evaluate conditions with operators (
>,<,>=,<=,=) - 🌳 Nested conditions with
AND/OR - 🛠 Custom functions (e.g.,
length(name)) - ⚖️ Rule prioritization and stop-on-first-match
- 🔄 Dynamic rule reloading from files
- 📝 Templated outcomes (e.g.,
"Hello, {{name}}!")
📦 Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
📚 Usage
Simple Rule Evaluation
This example shows a basic rule that checks if an age is over 18:
use ;
use HashMap;
use serde_json;
Advanced Example
This example demonstrates nested conditions, templating, and contextual data:
use ;
use HashMap;
use serde_json;
🗺 Roadmap
- Rule Chaining
- Type Safety for Inputs and Outputs
- Performance Optimization
- Debugging and Logging
- Extensibility via Plugins
- Multi-Format Rule Support
📄 License
Licensed under either of:
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) at your option.