Skip to main content

Rule

Trait Rule 

Source
pub trait Rule:
    Any
    + Send
    + Sync {
Show 13 methods // Required methods fn evaluate(&self, context: &RuleContext) -> RuleResult; fn priority(&self) -> u8; fn description(&self) -> String; fn state(&self) -> RuleState; fn as_any(&self) -> &dyn Any; fn as_any_mut(&mut self) -> &mut dyn Any; // Provided methods fn is_active(&self) -> bool { ... } fn activate(&mut self) { ... } fn is_relaxable(&self) -> bool { ... } fn deactivate(&mut self) { ... } fn relax(&mut self) { ... } fn reset(&mut self) { ... } fn delay(&self) -> u8 { ... }
}
Expand description

A condition checked at every node of the search.

Required Methods§

Source

fn evaluate(&self, context: &RuleContext) -> RuleResult

Decides whether the search continues below the node.

Source

fn priority(&self) -> u8

Rules with a higher priority are evaluated first.

Source

fn description(&self) -> String

A short human-readable name.

Source

fn state(&self) -> RuleState

The current state of the rule.

Source

fn as_any(&self) -> &dyn Any

Upcast used by RuleManager::get_rule_mut.

Source

fn as_any_mut(&mut self) -> &mut dyn Any

Mutable upcast used by RuleManager::get_rule_mut.

Provided Methods§

Source

fn is_active(&self) -> bool

Whether the rule is applied.

Source

fn activate(&mut self)

Starts applying the rule; called before the first pass.

Source

fn is_relaxable(&self) -> bool

Whether the rule restricts the search only temporarily. A search whose pass was cut by a relaxable rule is not finished.

Source

fn deactivate(&mut self)

Stops applying the rule.

Source

fn relax(&mut self)

Widens the rule’s budget before the next pass, or deactivates it once the budget is at its limit.

Source

fn reset(&mut self)

Resets any internal state, such as a timer.

Source

fn delay(&self) -> u8

Number of passes to wait before the rule takes effect.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§