Skip to main content

QueryCapture

Trait QueryCapture 

Source
pub trait QueryCapture<'query, 'tree: 'query>: Debug + Clone {
    type Query: Query<Capture<'query, 'tree> = Self>;

    // Required methods
    fn query(&self) -> &'query Self::Query;
    fn raw(&self) -> QueryCapture<'tree>;
    fn node(&self) -> &UntypedNode<'tree>;
    fn node_mut(&mut self) -> &mut UntypedNode<'tree>;
    fn name(&self) -> &'query str;

    // Provided method
    fn index(&self) -> usize { ... }
}
Expand description

A capture from a Query with typed nodes

Required Associated Types§

Source

type Query: Query<Capture<'query, 'tree> = Self>

The type of query this capture came from

Required Methods§

Source

fn query(&self) -> &'query Self::Query

The query this capture came from

Source

fn raw(&self) -> QueryCapture<'tree>

Get the raw tree-sitter query captures.

Source

fn node(&self) -> &UntypedNode<'tree>

Get the captured untyped node

Source

fn node_mut(&mut self) -> &mut UntypedNode<'tree>

Get a mutable reference to the captured untyped node

Source

fn name(&self) -> &'query str

Get the capture name

Provided Methods§

Source

fn index(&self) -> usize

Get the capture index

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§