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>

source

pub fn iter_captures( &self ) -> impl Iterator<Item = QueryCapture<'query, 'tree, Custom>>

Iterate all captures in the order they appear.

source

pub fn capture( &self, index: usize ) -> Option<QueryCapture<'query, 'tree, Custom>>

Get the capture at the given index (order it appears).

source

pub fn capture_named( &self, name: &str ) -> Option<QueryCapture<'query, 'tree, Custom>>

Get the first occurrence of the capture with the given name.

source

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.

source

pub fn capture_count(&self) -> usize

Get the number of captures in this match.

source

pub fn pattern_index(&self) -> usize

Get the pattern index of this match.

source

pub fn id(&self) -> u32

Get the id of this match (honestly I don’t know what this does because it’s not documented)

source

pub fn remove(self)

Remove the match (honestly I don’t know what this does because it’s not documented)

source

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§

source§

impl<'query, 'tree, Custom> Debug for QueryMatch<'query, 'tree, Custom>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.