pub struct KnowledgeBase { /* private fields */ }Expand description
Knowledge Base - manages collections of rules and facts Similar to Grule’s KnowledgeBase concept
Implementations§
Source§impl KnowledgeBase
impl KnowledgeBase
Sourcepub fn add_rules_from_grl(&self, grl_text: &str) -> Result<usize>
pub fn add_rules_from_grl(&self, grl_text: &str) -> Result<usize>
Add multiple rules from GRL text
Sourcepub fn remove_rule(&self, rule_name: &str) -> Result<bool>
pub fn remove_rule(&self, rule_name: &str) -> Result<bool>
Remove a rule by name
Sourcepub fn get_rule_names(&self) -> Vec<String>
pub fn get_rule_names(&self) -> Vec<String>
Get all rule names
Sourcepub fn rule_count(&self) -> usize
pub fn rule_count(&self) -> usize
Get rule count
Sourcepub fn set_rule_enabled(&self, rule_name: &str, enabled: bool) -> Result<bool>
pub fn set_rule_enabled(&self, rule_name: &str, enabled: bool) -> Result<bool>
Enable or disable a rule
Sourcepub fn get_rules_snapshot(&self) -> Vec<Rule>
pub fn get_rules_snapshot(&self) -> Vec<Rule>
Get a snapshot of all rules (for execution)
Sourcepub fn get_statistics(&self) -> KnowledgeBaseStats
pub fn get_statistics(&self) -> KnowledgeBaseStats
Get knowledge base statistics
Sourcepub fn export_to_grl(&self) -> String
pub fn export_to_grl(&self) -> String
Export rules to GRL format
Trait Implementations§
Source§impl Clone for KnowledgeBase
impl Clone for KnowledgeBase
Auto Trait Implementations§
impl Freeze for KnowledgeBase
impl RefUnwindSafe for KnowledgeBase
impl Send for KnowledgeBase
impl Sync for KnowledgeBase
impl Unpin for KnowledgeBase
impl UnwindSafe for KnowledgeBase
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