pub(crate) trait Rule {
    type Match;

    fn name(&self) -> &'static str;
    fn strategy(&self) -> ApplyStrategy;
    fn required_attributes(&self) -> HashSet<Box<dyn Attribute>>;
    fn check(&self, model: &Model, box_id: BoxId) -> Option<Self::Match>;
    fn rewrite(&self, model: &mut Model, mat: Self::Match);
}
Expand description

Trait that all rewrite rules must implement.

Required Associated Types§

The type of matches associated with this Rule.

Required Methods§

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

The ApplyStrategy for the rule.

Derived attributes required by this Rule.

Determines how to rewrite the box.

Returns None if the box does not need to be rewritten.

Rewrites the Model based on the parameters of Self::Match determined by a previous Rule::check call.

Implementors§