Struct tree_sitter::QueryCursor [−][src]
pub struct QueryCursor(_);
Expand description
A stateful object for executing a Query
on a syntax Tree
.
Implementations
impl<'a> QueryCursor
[src]
impl<'a> QueryCursor
[src]pub fn new() -> Self
[src]
pub fn new() -> Self
[src]Create a new cursor for executing a given query.
The cursor stores the state that is needed to iteratively search for matches.
pub fn did_exceed_match_limit(&self) -> bool
[src]
pub fn did_exceed_match_limit(&self) -> bool
[src]Check if, on its last execution, this cursor exceeded its maximum number of in-progress matches.
pub fn matches<'tree: 'a, T: AsRef<[u8]>>(
&'a mut self,
query: &'a Query,
node: Node<'tree>,
text_callback: impl FnMut(Node<'tree>) -> T + 'a
) -> impl Iterator<Item = QueryMatch<'tree>> + 'a
[src]
pub fn matches<'tree: 'a, T: AsRef<[u8]>>(
&'a mut self,
query: &'a Query,
node: Node<'tree>,
text_callback: impl FnMut(Node<'tree>) -> T + 'a
) -> impl Iterator<Item = QueryMatch<'tree>> + 'a
[src]Iterate over all of the matches in the order that they were found.
Each match contains the index of the pattern that matched, and a list of captures. Because multiple patterns can match the same set of nodes, one match may contain captures that appear before some of the captures from a previous match.
pub fn captures<'tree, T: AsRef<[u8]>>(
&'a mut self,
query: &'a Query,
node: Node<'tree>,
text_callback: impl FnMut(Node<'tree>) -> T + 'a
) -> QueryCaptures<'a, 'tree, T>ⓘNotable traits for QueryCaptures<'a, 'tree, T>
impl<'a, 'tree: 'a, T: AsRef<[u8]>> Iterator for QueryCaptures<'a, 'tree, T> type Item = (QueryMatch<'tree>, usize);
[src]
pub fn captures<'tree, T: AsRef<[u8]>>(
&'a mut self,
query: &'a Query,
node: Node<'tree>,
text_callback: impl FnMut(Node<'tree>) -> T + 'a
) -> QueryCaptures<'a, 'tree, T>ⓘNotable traits for QueryCaptures<'a, 'tree, T>
impl<'a, 'tree: 'a, T: AsRef<[u8]>> Iterator for QueryCaptures<'a, 'tree, T> type Item = (QueryMatch<'tree>, usize);
[src]Iterate over all of the individual captures in the order that they appear.
This is useful if don’t care about which pattern matched, and just want a single, ordered sequence of captures.
pub fn set_byte_range(&mut self, start: usize, end: usize) -> &mut Self
[src]
pub fn set_byte_range(&mut self, start: usize, end: usize) -> &mut Self
[src]Set the range in which the query will be executed, in terms of byte offsets.
pub fn set_point_range(&mut self, start: Point, end: Point) -> &mut Self
[src]
pub fn set_point_range(&mut self, start: Point, end: Point) -> &mut Self
[src]Set the range in which the query will be executed, in terms of rows and columns.
Trait Implementations
impl Drop for QueryCursor
[src]
impl Drop for QueryCursor
[src]