Enum ast_grep_config::Rule
source · [−]pub enum Rule<L: Language> {
All(All<L, Rule<L>>),
Any(Any<L, Rule<L>>),
Not(Box<Not<L, Rule<L>>>),
Inside(Box<Inside<L>>),
Has(Box<Has<L>>),
Precedes(Box<Precedes<L>>),
Follows(Box<Follows<L>>),
Pattern(Pattern<L>),
Kind(KindMatcher<L>),
}Variants
All(All<L, Rule<L>>)
Any(Any<L, Rule<L>>)
Not(Box<Not<L, Rule<L>>>)
Inside(Box<Inside<L>>)
Has(Box<Has<L>>)
Precedes(Box<Precedes<L>>)
Follows(Box<Follows<L>>)
Pattern(Pattern<L>)
Kind(KindMatcher<L>)
Trait Implementations
sourceimpl<L: Language> Matcher<L> for Rule<L>
impl<L: Language> Matcher<L> for Rule<L>
sourcefn match_node_with_env<'tree>(
&self,
node: Node<'tree, L>,
env: &mut MetaVarEnv<'tree, L>
) -> Option<Node<'tree, L>>
fn match_node_with_env<'tree>(
&self,
node: Node<'tree, L>,
env: &mut MetaVarEnv<'tree, L>
) -> Option<Node<'tree, L>>
Returns the node why the input is matched or None if not matched.
The return value is usually input node itself, but it can be different node.
For example
Has matcher can return the child or descendant node. Read morefn match_node(&self, node: Node<'tree, L>) -> Option<NodeMatch<'tree, L>>
fn get_meta_var_matchers(&self) -> MetaVarMatchers<L>
fn get_meta_var_env<'tree>(&self) -> MetaVarEnv<'tree, L>
fn find_node_with_env(
&self,
node: Node<'tree, L>,
env: &mut MetaVarEnv<'tree, L>
) -> Option<Node<'tree, L>>
fn find_node(&self, node: Node<'tree, L>) -> Option<NodeMatch<'tree, L>>
fn find_all_nodes(self, node: Node<'_, L>) -> FindAllNodes<'_, L, Self>
Auto Trait Implementations
impl<L> RefUnwindSafe for Rule<L>where
L: RefUnwindSafe,
impl<L> Send for Rule<L>where
L: Send,
impl<L> Sync for Rule<L>where
L: Sync,
impl<L> Unpin for Rule<L>where
L: Unpin,
impl<L> UnwindSafe for Rule<L>where
L: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more