pub struct PatternMatch {
pub matched_nodes: Vec<usize>,
pub captures: HashMap<String, Vec<usize>>,
pub matched_tensors: HashSet<usize>,
}Expand description
Result of a successful pattern match
Fields§
§matched_nodes: Vec<usize>Indices of matched nodes in order
captures: HashMap<String, Vec<usize>>Captured subpatterns by name
matched_tensors: HashSet<usize>Matched tensors (inputs and outputs)
Implementations§
Source§impl PatternMatch
impl PatternMatch
Sourcepub fn add_capture(&mut self, name: String, node_idx: usize)
pub fn add_capture(&mut self, name: String, node_idx: usize)
Add a capture
Sourcepub fn get_capture(&self, name: &str) -> Option<&[usize]>
pub fn get_capture(&self, name: &str) -> Option<&[usize]>
Get nodes for a capture by name
Trait Implementations§
Source§impl Clone for PatternMatch
impl Clone for PatternMatch
Source§fn clone(&self) -> PatternMatch
fn clone(&self) -> PatternMatch
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 moreSource§impl Debug for PatternMatch
impl Debug for PatternMatch
Auto Trait Implementations§
impl Freeze for PatternMatch
impl RefUnwindSafe for PatternMatch
impl Send for PatternMatch
impl Sync for PatternMatch
impl Unpin for PatternMatch
impl UnwindSafe for PatternMatch
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