Struct yak_sitter::QueryMatch
source · pub struct QueryMatch<'query, 'tree, Custom = ()> { /* private fields */ }
Expand description
Wrapper around tree_sitter::QueryMatch
Implementations§
source§impl<'query, 'tree, Custom> QueryMatch<'query, 'tree, Custom>
impl<'query, 'tree, Custom> QueryMatch<'query, 'tree, Custom>
sourcepub fn iter_captures(
&self
) -> impl Iterator<Item = QueryCapture<'query, 'tree, Custom>>
pub fn iter_captures( &self ) -> impl Iterator<Item = QueryCapture<'query, 'tree, Custom>>
Iterate all captures in the order they appear.
sourcepub fn capture(
&self,
index: usize
) -> Option<QueryCapture<'query, 'tree, Custom>>
pub fn capture( &self, index: usize ) -> Option<QueryCapture<'query, 'tree, Custom>>
Get the capture at the given index (order it appears).
sourcepub fn capture_named(
&self,
name: &str
) -> Option<QueryCapture<'query, 'tree, Custom>>
pub fn capture_named( &self, name: &str ) -> Option<QueryCapture<'query, 'tree, Custom>>
Get the first occurrence of the capture with the given name.
sourcepub fn captures_named<'a>(
&'a self,
name: &'a str
) -> impl Iterator<Item = QueryCapture<'query, 'tree, Custom>> + 'a
pub fn captures_named<'a>( &'a self, name: &'a str ) -> impl Iterator<Item = QueryCapture<'query, 'tree, Custom>> + 'a
Get every occurrence of the captures with the given name.
sourcepub fn capture_count(&self) -> usize
pub fn capture_count(&self) -> usize
Get the number of captures in this match.
sourcepub fn pattern_index(&self) -> usize
pub fn pattern_index(&self) -> usize
Get the pattern index of this match.
sourcepub fn id(&self) -> u32
pub fn id(&self) -> u32
Get the id of this match (honestly I don’t know what this does because it’s not documented)
sourcepub fn remove(self)
pub fn remove(self)
Remove the match (honestly I don’t know what this does because it’s not documented)
sourcepub fn nodes_for_capture_index(
&self,
capture_index: u32
) -> impl Iterator<Item = Node<'tree, Custom>> + '_
pub fn nodes_for_capture_index( &self, capture_index: u32 ) -> impl Iterator<Item = Node<'tree, Custom>> + '_
Get the nodes that were captures by the capture at the given index.
Trait Implementations§
Auto Trait Implementations§
impl<'query, 'tree, Custom> Freeze for QueryMatch<'query, 'tree, Custom>
impl<'query, 'tree, Custom> RefUnwindSafe for QueryMatch<'query, 'tree, Custom>where
Custom: RefUnwindSafe,
impl<'query, 'tree, Custom = ()> !Send for QueryMatch<'query, 'tree, Custom>
impl<'query, 'tree, Custom = ()> !Sync for QueryMatch<'query, 'tree, Custom>
impl<'query, 'tree, Custom> Unpin for QueryMatch<'query, 'tree, Custom>
impl<'query, 'tree, Custom> UnwindSafe for QueryMatch<'query, 'tree, Custom>where
Custom: RefUnwindSafe,
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