conjure_oxide

Function get_rule_sets

Source
pub fn get_rule_sets() -> Vec<&'static RuleSet<'static>>
Expand description

Get all rule sets Returns a Vec of static references to all rule sets registered with the register_rule_set macro. Rule sets are not guaranteed to be in any particular order.

ยงExample

use conjure_core::rule_engine::register_rule_set;
use conjure_core::rule_engine::get_rule_sets;

register_rule_set!("MyRuleSet", 10, ("AnotherRuleSet"));
register_rule_set!("AnotherRuleSet", 5, ());

println!("Rule sets: {:?}", get_rule_sets());

This will print (if no other rule sets are registered):

Rule sets: [
  RuleSet { name: "MyRuleSet", order: 10, rules: OnceLock { state: Uninitialized }, dependencies: ["AnotherRuleSet"] },
  RuleSet { name: "AnotherRuleSet", order: 5, rules: OnceLock { state: Uninitialized }, dependencies: [] }
]