pub struct ReteUlEngine { /* private fields */ }Expand description
RETE-UL Engine with cached nodes (Performance optimized!) This engine builds RETE nodes once and reuses them, avoiding expensive rebuilds
Implementations§
Source§impl ReteUlEngine
impl ReteUlEngine
Sourcepub fn add_rule_with_action<F>(
&mut self,
name: String,
node: ReteUlNode,
priority: i32,
no_loop: bool,
action: F,
)
pub fn add_rule_with_action<F>( &mut self, name: String, node: ReteUlNode, priority: i32, no_loop: bool, action: F, )
Add a rule with custom action closure
Sourcepub fn add_rule_from_definition(
&mut self,
rule: &Rule,
priority: i32,
no_loop: bool,
)
pub fn add_rule_from_definition( &mut self, rule: &Rule, priority: i32, no_loop: bool, )
Add a rule from Rule definition (auto-build node once and cache)
Sourcepub fn remove_fact(&mut self, key: &str) -> Option<String>
pub fn remove_fact(&mut self, key: &str) -> Option<String>
Remove a fact
Sourcepub fn get_all_facts(&self) -> &HashMap<String, String>
pub fn get_all_facts(&self) -> &HashMap<String, String>
Get all facts
Sourcepub fn clear_facts(&mut self)
pub fn clear_facts(&mut self)
Clear all facts
Sourcepub fn fire_all(&mut self) -> Vec<String>
pub fn fire_all(&mut self) -> Vec<String>
Fire all rules with agenda (using cached nodes - NO rebuild!)
Sourcepub fn matches(&self, rule_name: &str) -> bool
pub fn matches(&self, rule_name: &str) -> bool
Check if a specific rule matches current facts (without firing)
Sourcepub fn get_matching_rules(&self) -> Vec<&str>
pub fn get_matching_rules(&self) -> Vec<&str>
Get all matching rules (without firing)
Sourcepub fn reset_fired_flags(&mut self)
pub fn reset_fired_flags(&mut self)
Reset fired flags (allow rules to fire again)
Auto Trait Implementations§
impl Freeze for ReteUlEngine
impl !RefUnwindSafe for ReteUlEngine
impl !Send for ReteUlEngine
impl !Sync for ReteUlEngine
impl Unpin for ReteUlEngine
impl !UnwindSafe for ReteUlEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more