Struct ast_grep_config::RuleWithConstraint
source · pub struct RuleWithConstraint<L: Language> { /* private fields */ }Implementations§
source§impl<L: Language> RuleWithConstraint<L>
impl<L: Language> RuleWithConstraint<L>
pub fn new(rule: Rule<L>) -> Self
pub fn with_matchers(self, matchers: MetaVarMatchers<StrDoc<L>>) -> Self
pub fn with_utils(self, _utils: RuleRegistration<L>) -> Self
pub fn with_transform( self, transform: Option<HashMap<String, Transformation>> ) -> Self
Methods from Deref<Target = Rule<L>>§
pub fn is_atomic(&self) -> bool
pub fn is_relational(&self) -> bool
pub fn is_composite(&self) -> bool
Trait Implementations§
source§impl<L: Language> Default for RuleWithConstraint<L>
impl<L: Language> Default for RuleWithConstraint<L>
source§impl<L: Language> Deref for RuleWithConstraint<L>
impl<L: Language> Deref for RuleWithConstraint<L>
source§impl<L: Language> Matcher<L> for RuleWithConstraint<L>
impl<L: Language> Matcher<L> for RuleWithConstraint<L>
source§fn match_node_with_env<'tree, D: Doc<Lang = L>>(
&self,
node: Node<'tree, D>,
env: &mut Cow<'_, MetaVarEnv<'tree, D>>
) -> Option<Node<'tree, D>>
fn match_node_with_env<'tree, D: Doc<Lang = L>>( &self, node: Node<'tree, D>, env: &mut Cow<'_, MetaVarEnv<'tree, D>> ) -> Option<Node<'tree, D>>
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.source§fn potential_kinds(&self) -> Option<BitSet>
fn potential_kinds(&self) -> Option<BitSet>
Returns a bitset for all possible target node kind ids.
Returns None if the matcher needs to try against all node kind.
source§fn get_match_len<D>(&self, _node: Node<'_, D>) -> Option<usize>where
D: Doc<Lang = L>,
fn get_match_len<D>(&self, _node: Node<'_, D>) -> Option<usize>where D: Doc<Lang = L>,
get_match_len will skip trailing anonymous child node to exclude punctuation.
fn match_node<D, 'tree>( &self, node: Node<'tree, D> ) -> Option<NodeMatch<'tree, D>>where D: Doc<Lang = L>,
fn find_node<D, 'tree>( &self, node: Node<'tree, D> ) -> Option<NodeMatch<'tree, D>>where D: Doc<Lang = L>,
Auto Trait Implementations§
impl<L> RefUnwindSafe for RuleWithConstraint<L>where L: RefUnwindSafe,
impl<L> Send for RuleWithConstraint<L>where L: Send + Sync,
impl<L> Sync for RuleWithConstraint<L>where L: Send + Sync,
impl<L> Unpin for RuleWithConstraint<L>where L: Unpin,
impl<L> UnwindSafe for RuleWithConstraint<L>where L: 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
Mutably borrows from an owned value. Read more