Expand description
§jsonlogic-fast
Fast, embeddable, cross-runtime JSON-Logic evaluation.
Implements the full JsonLogic specification with batch evaluation, numeric coercion, and parallel execution via Rayon (sequential on WASM).
§Quick start
use jsonlogic_fast::evaluate;
let rule = r#"{">":[{"var":"age"},18]}"#;
let context = r#"{"age":25}"#;
let result = evaluate(rule, context).unwrap();
assert_eq!(result, serde_json::json!(true));§Batch evaluation
use jsonlogic_fast::evaluate_batch;
let rule = r#"{"var":"score"}"#;
let contexts = vec![
r#"{"score":90}"#.to_string(),
r#"{"score":45}"#.to_string(),
];
let results = evaluate_batch(rule, &contexts).unwrap();
assert_eq!(results, vec![serde_json::json!(90), serde_json::json!(45)]);Modules§
Structs§
- Evaluation
Result - Result of a single rule evaluation with optional error.
- Numeric
Evaluation Result - Numeric evaluation result with optional error.
Functions§
- evaluate
- Evaluate a JSON-Logic rule against a single JSON context.
- evaluate_
batch - Evaluate a rule against many contexts (parallel on native, sequential on WASM).
- evaluate_
batch_ detailed - Like
evaluate_batchbut returnsEvaluationResultwith error details. - evaluate_
batch_ numeric - Batch-evaluate and coerce every result to
f64. - evaluate_
batch_ numeric_ detailed - Like
evaluate_batch_numericbut returnsNumericEvaluationResultwith errors. - evaluate_
numeric - Evaluate a rule and coerce the result to
f64. - evaluate_
rule - Alias for
evaluate. - get_
core_ info - Return engine metadata (version, parallelism mode, thread count).
- serialize
- Serialize any
Serializeimplementor to a JSON string. - serialize_
value - Serialize a
Valueto a JSON string. - validate_
rule - Validate that a rule can be evaluated without errors.