pub struct KindMatcher { /* private fields */ }
Implementations§
Source§impl KindMatcher
impl KindMatcher
pub fn new<L: Language>(node_kind: &str, lang: L) -> Self
pub fn try_new<L: Language>( node_kind: &str, lang: L, ) -> Result<Self, KindMatcherError>
pub fn from_id(kind: u16) -> Self
Sourcepub fn is_invalid(&self) -> bool
pub fn is_invalid(&self) -> bool
Whether the kind matcher contains undefined tree-sitter kind.
Sourcepub fn error_matcher() -> Self
pub fn error_matcher() -> Self
Construct a matcher that only matches ERROR
Trait Implementations§
Source§impl Clone for KindMatcher
impl Clone for KindMatcher
Source§fn clone(&self) -> KindMatcher
fn clone(&self) -> KindMatcher
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 Matcher for KindMatcher
impl Matcher for KindMatcher
Source§fn match_node_with_env<'tree, D: Doc>(
&self,
node: Node<'tree, D>,
_env: &mut Cow<'_, MetaVarEnv<'tree, D>>,
) -> Option<Node<'tree, D>>
fn match_node_with_env<'tree, D: Doc>( &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.
Auto Trait Implementations§
impl Freeze for KindMatcher
impl RefUnwindSafe for KindMatcher
impl Send for KindMatcher
impl Sync for KindMatcher
impl Unpin for KindMatcher
impl UnwindSafe for KindMatcher
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