pub enum PatternNode {
MetaVar {
meta_var: MetaVariable,
},
Terminal {
text: String,
is_named: bool,
kind_id: u16,
},
Internal {
kind_id: u16,
children: Vec<Self>,
},
}Expand description
Internal representation of a pattern’s structure.
Patterns are compiled into a tree of PatternNode elements that
efficiently represent the matching logic for different AST structures.
Variants§
MetaVar
Meta-variable that captures matched content
Fields
§
meta_var: MetaVariableThe meta-variable specification (e.g., $VAR, $$$ITEMS)
Terminal
Leaf node with specific text content
Fields
Internal
Internal node with child patterns
Implementations§
Source§impl PatternNode
impl PatternNode
pub const fn is_trivial(&self) -> bool
pub fn fixed_string(&self) -> Cow<'_, str>
Trait Implementations§
Source§impl Clone for PatternNode
impl Clone for PatternNode
Source§fn clone(&self) -> PatternNode
fn clone(&self) -> PatternNode
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 PatternNode
impl Debug for PatternNode
Auto Trait Implementations§
impl Freeze for PatternNode
impl RefUnwindSafe for PatternNode
impl Send for PatternNode
impl Sync for PatternNode
impl Unpin for PatternNode
impl UnsafeUnpin for PatternNode
impl UnwindSafe for PatternNode
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