pub struct RustRuleEngine { /* private fields */ }Expand description
Rust Rule Engine - High-performance rule execution engine
Implementations§
Source§impl RustRuleEngine
impl RustRuleEngine
Sourcepub fn new(knowledge_base: KnowledgeBase) -> Self
pub fn new(knowledge_base: KnowledgeBase) -> Self
Create a new RustRuleEngine with default configuration
Sourcepub fn with_config(knowledge_base: KnowledgeBase, config: EngineConfig) -> Self
pub fn with_config(knowledge_base: KnowledgeBase, config: EngineConfig) -> Self
Create a new RustRuleEngine with custom configuration
Sourcepub fn register_function<F>(&mut self, name: &str, func: F)
pub fn register_function<F>(&mut self, name: &str, func: F)
Register a custom function
Sourcepub fn register_action_handler<F>(&mut self, action_type: &str, handler: F)
pub fn register_action_handler<F>(&mut self, action_type: &str, handler: F)
Register a custom action handler
Sourcepub fn enable_analytics(&mut self, analytics: RuleAnalytics)
pub fn enable_analytics(&mut self, analytics: RuleAnalytics)
Enable analytics with custom configuration
Sourcepub fn reset_no_loop_tracking(&mut self)
pub fn reset_no_loop_tracking(&mut self)
Reset global no-loop tracking (useful for testing or when facts change significantly)
Sourcepub fn disable_analytics(&mut self)
pub fn disable_analytics(&mut self)
Disable analytics
Sourcepub fn analytics(&self) -> Option<&RuleAnalytics>
pub fn analytics(&self) -> Option<&RuleAnalytics>
Get reference to analytics data
Sourcepub fn has_function(&self, name: &str) -> bool
pub fn has_function(&self, name: &str) -> bool
Check if a custom function is registered
Sourcepub fn has_action_handler(&self, action_type: &str) -> bool
pub fn has_action_handler(&self, action_type: &str) -> bool
Check if a custom action handler is registered
Sourcepub fn knowledge_base(&self) -> &KnowledgeBase
pub fn knowledge_base(&self) -> &KnowledgeBase
Get reference to the knowledge base
Sourcepub fn knowledge_base_mut(&mut self) -> &mut KnowledgeBase
pub fn knowledge_base_mut(&mut self) -> &mut KnowledgeBase
Get mutable reference to the knowledge base
Sourcepub fn set_agenda_focus(&mut self, group: &str)
pub fn set_agenda_focus(&mut self, group: &str)
Set focus to a specific agenda group
Sourcepub fn get_active_agenda_group(&self) -> &str
pub fn get_active_agenda_group(&self) -> &str
Get the currently active agenda group
Sourcepub fn pop_agenda_focus(&mut self) -> Option<String>
pub fn pop_agenda_focus(&mut self) -> Option<String>
Pop the agenda focus stack
Sourcepub fn clear_agenda_focus(&mut self)
pub fn clear_agenda_focus(&mut self)
Clear all agenda focus and return to MAIN
Sourcepub fn get_agenda_groups(&self) -> Vec<String>
pub fn get_agenda_groups(&self) -> Vec<String>
Get all agenda groups that have rules
Sourcepub fn get_activation_groups(&self) -> Vec<String>
pub fn get_activation_groups(&self) -> Vec<String>
Get all activation groups that have rules
Sourcepub fn execute(&mut self, facts: &Facts) -> Result<GruleExecutionResult>
pub fn execute(&mut self, facts: &Facts) -> Result<GruleExecutionResult>
Execute all rules in the knowledge base against the given facts
Sourcepub fn execute_at_time(
&mut self,
facts: &Facts,
timestamp: DateTime<Utc>,
) -> Result<GruleExecutionResult>
pub fn execute_at_time( &mut self, facts: &Facts, timestamp: DateTime<Utc>, ) -> Result<GruleExecutionResult>
Execute all rules at a specific timestamp (for date-effective/expires testing)