Skip to main content

Module rule_engine

Module rule_engine 

Source

Modules§

_dependencies

Macros§

register_rule_set
Register a rule set with the given name, dependencies, and metadata.Example

Structs§

Rule
A rule with a name, application function, and rule sets.
RuleData
Holds a rule and its priority, along with the rule set it came from.
RuleEffect
Represents the result of applying a rule to an expression within a model.
RuleSet
A structure representing a set of rules with a name, priority, and dependencies.

Enums§

ApplicationError
AtomKind
Atomic expression subvariants that can be used as rule prefilters.
RewriteError
Represents errors that can occur during the model rewriting process.
RuleFailureInvalidation
State changes that can invalidate a failed rule application.
RulePrefilter
A complete rule prefilter alternative.

Functions§

get_all_rule_sets
Get all rule sets Returns a Vec of static references to all rule sets registered with the register_rule_set macro. Rule sets are not guaranteed to be in any particular order.
get_all_rules
Returns a copied Vec of all rules registered with the register_rule macro.
get_rule_by_name
Get a rule by name. Returns the rule with the given name or None if it doesn’t exist.
get_rule_set_by_name
Get a rule set by name. Returns the rule set with the given name or None if it doesn’t exist.
get_rule_sets_for_solver_family
Get all rule sets for a given solver family. Returns a Vec of static references to all rule sets that are applicable to the given solver family. Rule sets are not guaranteed to be in any particular order.
get_rules
Build a list of rules to apply (sorted by priority) from a list of rule sets.
get_rules_grouped
Get rules grouped by priority from a list of rule sets.
resolve_rule_sets
Resolves the final set of rule sets to apply based on target solver family and extra rule set names.
rewrite_model
Rewrites a model by applying rules in priority order, trying enclosing expressions before their descendants at each priority.
rewrite_model_with_configured_rewriter
Rewrites a model using the supplied rewriter configuration.

Type Aliases§

ApplicationResult
The result of applying a rule to an expression. Contains either a set of rule effects or an error.
RuleFn
The function type used in a Rule.

Attribute Macros§

register_rule
Register a rule with the given rule sets and priorities.