pub struct BaseRule { /* private fields */ }Expand description
Base implementation for rules with callback support
Implementations§
Source§impl BaseRule
impl BaseRule
pub fn new() -> Self
Sourcepub fn set_eval_fn<F>(&mut self, f: F)
pub fn set_eval_fn<F>(&mut self, f: F)
Set the evaluation function
Sourcepub fn set_pre_execute_fn<F>(&mut self, f: F)
pub fn set_pre_execute_fn<F>(&mut self, f: F)
Set the pre-execution function
Sourcepub fn set_execute_fn<F>(&mut self, f: F)
pub fn set_execute_fn<F>(&mut self, f: F)
Set the execution function
Sourcepub fn set_post_execute_fn<F>(&mut self, f: F)
pub fn set_post_execute_fn<F>(&mut self, f: F)
Set the post-execution function
Trait Implementations§
Source§impl Rule for BaseRule
impl Rule for BaseRule
Source§fn evaluate(&self, context: &RuleContext) -> RuleResult<bool>
fn evaluate(&self, context: &RuleContext) -> RuleResult<bool>
Evaluate if this rule should execute
Source§fn execute(&mut self, context: &mut RuleContext) -> RuleResult<()>
fn execute(&mut self, context: &mut RuleContext) -> RuleResult<()>
Execute the rule with proper error handling
Source§fn add_children(&mut self, children: Vec<Box<dyn Rule>>) -> RuleResult<()>
fn add_children(&mut self, children: Vec<Box<dyn Rule>>) -> RuleResult<()>
Add multiple child rules
Source§fn fire(&mut self, context: &mut RuleContext) -> RuleResult<bool>
fn fire(&mut self, context: &mut RuleContext) -> RuleResult<bool>
Execute the complete rule lifecycle: evaluate, execute, and run children
Auto Trait Implementations§
impl Freeze for BaseRule
impl !RefUnwindSafe for BaseRule
impl !Send for BaseRule
impl !Sync for BaseRule
impl Unpin for BaseRule
impl !UnwindSafe for BaseRule
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