pub struct RuleSet<'a> {
pub name: &'a str,
pub order: u16,
pub solver_families: &'a [SolverFamily],
/* private fields */
}
Expand description
A structure representing a set of rules with a name, priority, and dependencies.
RuleSet
is a way to group related rules together under a single name.
You can think of it like a list of rules that belong to the same category.
Each RuleSet
can also have a number that tells it what order it should run in compared to other RuleSet
instances.
Additionally, a RuleSet
can depend on other RuleSet
instances, meaning it needs them to run first.
To make things efficient, RuleSet
only figures out its rules and dependencies the first time they’re needed,
and then it remembers them so it doesn’t have to do the work again.
§Fields
name
: The name of the rule set.order
: A number that decides the order in which thisRuleSet
should be applied. If twoRuleSet
instances have the same rule but with different priorities, the one with the higherorder
number will be the one that is used.rules
: A lazily initialized map of rules to their priorities.dependency_rs_names
: The names of the rule sets that this rule set depends on.dependencies
: A lazily initialized set ofRuleSet
dependencies.solver_families
: The solver families that this rule set applies to.
Fields§
§name: &'a str
The name of the rule set.
order: u16
Order of the RuleSet. Used to establish a consistent order of operations when resolving rules. If two RuleSets overlap (contain the same rule but with different priorities), the RuleSet with the higher order will be used as the source of truth.
solver_families: &'a [SolverFamily]
The solver families that this rule set applies to.
Implementations§
Source§impl<'a> RuleSet<'a>
impl<'a> RuleSet<'a>
pub const fn new( name: &'a str, order: u16, dependencies: &'a [&'a str], solver_families: &'a [SolverFamily], ) -> RuleSet<'a>
Sourcepub fn get_rules(&self) -> &HashMap<&'a Rule<'a>, u16>
pub fn get_rules(&self) -> &HashMap<&'a Rule<'a>, u16>
Get the rules of this rule set, evaluating them lazily if necessary
Returns a &HashMap<&Rule, u16>
where the key is the rule and the value is the priority of the rule.
Sourcepub fn get_dependencies(&self) -> &HashSet<&'static RuleSet<'_>>
pub fn get_dependencies(&self) -> &HashSet<&'static RuleSet<'_>>
Get the dependencies of this rule set, evaluating them lazily if necessary
Returns a &HashSet<&RuleSet>
of the rule sets that this rule set depends on.
Sourcepub fn with_dependencies(&self) -> HashSet<&'static RuleSet<'_>>
pub fn with_dependencies(&self) -> HashSet<&'static RuleSet<'_>>
Get the dependencies of this rule set, including itself
Trait Implementations§
impl Eq for RuleSet<'_>
Auto Trait Implementations§
impl<'a> !Freeze for RuleSet<'a>
impl<'a> RefUnwindSafe for RuleSet<'a>
impl<'a> Send for RuleSet<'a>
impl<'a> Sync for RuleSet<'a>
impl<'a> Unpin for RuleSet<'a>
impl<'a> UnwindSafe for RuleSet<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more