pub struct GraphRewriteRule {
pub name: String,
pub pattern: GraphPattern,
pub rewriter: fn(&EinsumGraph, &PatternMatch) -> Result<Vec<EinsumNode>, IrError>,
pub priority: i32,
}Expand description
A rewrite rule that transforms matched patterns
Fields§
§name: StringName of this rule for debugging
pattern: GraphPatternPattern to match
rewriter: fn(&EinsumGraph, &PatternMatch) -> Result<Vec<EinsumNode>, IrError>Function to apply the rewrite
priority: i32Priority (higher = applied first)
Implementations§
Source§impl GraphRewriteRule
impl GraphRewriteRule
Sourcepub fn new(
name: impl Into<String>,
pattern: GraphPattern,
rewriter: fn(&EinsumGraph, &PatternMatch) -> Result<Vec<EinsumNode>, IrError>,
) -> Self
pub fn new( name: impl Into<String>, pattern: GraphPattern, rewriter: fn(&EinsumGraph, &PatternMatch) -> Result<Vec<EinsumNode>, IrError>, ) -> Self
Create a new rewrite rule
Sourcepub fn with_priority(self, priority: i32) -> Self
pub fn with_priority(self, priority: i32) -> Self
Set the priority of this rule
Trait Implementations§
Source§impl Clone for GraphRewriteRule
impl Clone for GraphRewriteRule
Source§fn clone(&self) -> GraphRewriteRule
fn clone(&self) -> GraphRewriteRule
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for GraphRewriteRule
impl RefUnwindSafe for GraphRewriteRule
impl Send for GraphRewriteRule
impl Sync for GraphRewriteRule
impl Unpin for GraphRewriteRule
impl UnwindSafe for GraphRewriteRule
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