Trait sql::query_model::rewrite::Rule [−][src]
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.
Associated Types
Required methods
fn strategy(&self) -> ApplyStrategy
fn strategy(&self) -> ApplyStrategy
The ApplyStrategy
for the rule.
fn required_attributes(&self) -> HashSet<Box<dyn Attribute>>
fn required_attributes(&self) -> HashSet<Box<dyn Attribute>>
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.