pub(crate) trait ApplyRule {
    fn name(&self) -> &'static str;
    fn strategy(&self) -> ApplyStrategy;
    fn required_attributes(&self) -> HashSet<Box<dyn Attribute>>;
    fn apply(&self, model: &mut Model, box_id: BoxId) -> bool;
}
Expand description

A trait with a blanket implementation that abstracts over the associated Rule::Match and its use sites Rule::check and Rule::rewrite behind ApplyRule::apply method.

Allows for holding a vector of rules in a Vec<dyn ApplyRule> instances.

Required Methods§

The name of the rule, used for debugging and tracing purposes.

The ApplyStrategy for the rule.

Derived attributes required by this ApplyRule.

Attempts to apply the rewrite to a subgraph rooted at the given box_id. Returns whether the attempt was successful.

Implementors§

Blanket implementation for ApplyRule for all Rule types.