pub enum MatchStrictness {
Cst,
Smart,
Ast,
Relaxed,
Signature,
}Expand description
Controls how precisely patterns must match AST structure.
Different strictness levels allow patterns to match with varying degrees of precision, from exact CST matching to loose structural matching.
§Variants
Cst- All nodes must match exactly (concrete syntax tree)Smart- Matches meaningful nodes, ignoring trivial syntaxAst- Only structural nodes matter (abstract syntax tree)Relaxed- Ignores comments and focuses on code structureSignature- Matches structure only, ignoring all text content
§Example
ⓘ
// With Cst strictness, these would be different:
// "let x=42;" vs "let x = 42;"
//
// With Ast strictness, they match the same pattern:
// "let $VAR = $VALUE"Variants§
Cst
Match all nodes exactly (Concrete Syntax Tree)
Smart
Match all nodes except trivial syntax elements
Ast
Match only structural AST nodes (Abstract Syntax Tree)
Relaxed
Match AST nodes while ignoring comments
Signature
Match structure only, ignoring all text content
Trait Implementations§
Source§impl Clone for MatchStrictness
impl Clone for MatchStrictness
Source§fn clone(&self) -> MatchStrictness
fn clone(&self) -> MatchStrictness
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 MatchStrictness
impl Debug for MatchStrictness
Source§impl FromStr for MatchStrictness
impl FromStr for MatchStrictness
impl Copy for MatchStrictness
Auto Trait Implementations§
impl Freeze for MatchStrictness
impl RefUnwindSafe for MatchStrictness
impl Send for MatchStrictness
impl Sync for MatchStrictness
impl Unpin for MatchStrictness
impl UnsafeUnpin for MatchStrictness
impl UnwindSafe for MatchStrictness
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