pub enum FusionPattern {
Node {
op: &'static str,
inputs: Vec<FusionPattern>,
bind: Cow<'static, str>,
},
Any {
bind: Cow<'static, str>,
},
VariadicNode {
op: &'static str,
child_pattern: Box<FusionPattern>,
bind: Cow<'static, str>,
min_children: usize,
},
}Expand description
A structural pattern that matches a subgraph of the Polydat DAG.
Patterns are trees — each sub-pattern matches exactly one node. Diamond shapes (two pattern leaves matching the same upstream node) are handled by bind-name equality checks after matching.
Variants§
Node
Match a node by its meta().name string.
Sub-patterns match the node’s inputs (respecting the node’s
declared commutativity). The node’s jit_constants() are
captured under bind.
Fields
inputs: Vec<FusionPattern>Sub-patterns for the node’s inputs.
Any
Match any wire source (coordinate, upstream node output, etc.). This is the “hole” — it captures the wire reference for rewiring to the fused replacement node.
VariadicNode
Match a variadic node with N children, applying a sub-pattern
to each child. Children are bound as {bind}_0, {bind}_1, etc.
Use for fusion rules that operate on variadic nodes like sum
where the number of inputs isn’t known at rule-definition time.
Implementations§
Trait Implementations§
Source§impl Clone for FusionPattern
impl Clone for FusionPattern
Auto Trait Implementations§
impl Forget for FusionPattern
impl Freeze for FusionPatternwhere
&'static str: Freeze,
*const u8 is !null: Freeze,
PhantomData<FusionPattern>: Freeze,
String: Freeze,
*const FusionPattern is !null: Freeze,
impl Move for FusionPattern
impl RefUnwindSafe for FusionPatternwhere
String: RefUnwindSafe,
impl Send for FusionPattern
impl Sync for FusionPattern
impl Unpin for FusionPattern
impl UnsafeUnpin for FusionPatternwhere
&'static str: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<FusionPattern>: UnsafeUnpin,
String: UnsafeUnpin,
*const FusionPattern is !null: UnsafeUnpin,
impl UnwindSafe for FusionPatternwhere
&'static str: UnwindSafe,
RawVecInner: UnwindSafe,
String: UnwindSafe,
BoxRaw<FusionPattern>: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more