pub struct RuleManager { /* private fields */ }Expand description
An ordered set of rules, evaluated by decreasing priority.
Implementations§
Source§impl RuleManager
impl RuleManager
Sourcepub fn activate_all(&mut self)
pub fn activate_all(&mut self)
Activates every rule.
Sourcepub fn add_rule(&mut self, rule: Box<dyn Rule>)
pub fn add_rule(&mut self, rule: Box<dyn Rule>)
Adds a rule, keeping the set sorted by priority.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn clear_rules(&mut self)
pub fn clear_rules(&mut self)
Removes every rule.
Sourcepub fn is_active(&self) -> bool
pub fn is_active(&self) -> bool
Whether some relaxable rule is still active, i.e. whether the search may still be restricted.
Sourcepub fn evaluate(&self, context: &RuleContext) -> RuleResult
pub fn evaluate(&self, context: &RuleContext) -> RuleResult
Evaluates the rules in order and returns the first one that stops the search, or a result that lets it continue.
Sourcepub fn get_rule_states(&self) -> Vec<(String, String)>
pub fn get_rule_states(&self) -> Vec<(String, String)>
(description, state) of every rule.
Sourcepub fn get_rule_mut<T: 'static>(&mut self) -> Option<&mut T>
pub fn get_rule_mut<T: 'static>(&mut self) -> Option<&mut T>
The first rule of type T, if any.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for RuleManager
impl !UnwindSafe for RuleManager
impl Freeze for RuleManager
impl Send for RuleManager
impl Sync for RuleManager
impl Unpin for RuleManager
impl UnsafeUnpin for RuleManager
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