pub struct RewriteRule {
pub name: String,
pub pattern: Pattern,
pub replacement: ReplacementFn,
pub priority: i32,
pub preserves_semantics: bool,
}Expand description
A graph rewrite rule.
Fields§
§name: StringRule name
pattern: PatternPattern to match
replacement: ReplacementFnReplacement function
priority: i32Rule priority (higher = applied first)
preserves_semantics: boolWhether this rule preserves semantics
Implementations§
Source§impl RewriteRule
impl RewriteRule
Sourcepub fn with_pattern(self, pattern: Pattern) -> Self
pub fn with_pattern(self, pattern: Pattern) -> Self
Set the pattern to match.
Sourcepub fn with_replacement<F>(self, f: F) -> Self
pub fn with_replacement<F>(self, f: F) -> Self
Set the replacement function.
Sourcepub fn with_priority(self, priority: i32) -> Self
pub fn with_priority(self, priority: i32) -> Self
Set the rule priority.
Sourcepub fn with_semantics_preservation(self, preserves: bool) -> Self
pub fn with_semantics_preservation(self, preserves: bool) -> Self
Mark whether this rule preserves semantics.
Auto Trait Implementations§
impl Freeze for RewriteRule
impl !RefUnwindSafe for RewriteRule
impl !Send for RewriteRule
impl !Sync for RewriteRule
impl Unpin for RewriteRule
impl !UnwindSafe for RewriteRule
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
Mutably borrows from an owned value. Read more