datalogic-rs
A high-performance Rust implementation of JSONLogic that provides a way to write portable logic rules as JSON. Fully compliant with the JSONLogic specification and optimized for production use.
Overview
datalogic-rs offers a complete, thread-safe implementation of the JSONLogic specification with:
- ๐ฏ 100% compliance with official JSONLogic test suite
- ๐ก๏ธ Strong type safety and error handling
- ๐ฆ Zero external runtime dependencies (only serde_json)
- ๐ Optimized performance with zero-copy deserialization
- ๐งต Thread-safe design using Arc for operator sharing
Installation
Add to your Cargo.toml:
[]
= "2.0.0"
Quick Example
use JsonLogic;
use json;
Supported Operations
All JSONLogic operations are supported:
- Comparison:
==,===,!=,!==,>,>=,<,<= - Logic:
!,!!,or,and,if,?: - Numeric:
+,-,*,/,%,min,max - Array:
map,filter,reduce,all,none,some,merge - String:
substr,cat,in - Data:
var,missing,missing_some - Custom:
preservefor data preservation
Performance
The library is optimized for production use with:
- Efficient operator dispatch using Arc
- Zero-copy JSON handling
- Optional auto-traversal of nested rules
- Comprehensive benchmarking suite
Testing
100% compatibility with official JSONLogic tests:
License
Licensed under Apache-2.0
Contributing
Contributions are welcome! The codebase has extensive documentation and test coverage.