[−][src]Struct tree_sitter::Query
A set of patterns that match nodes in a syntax tree.
Methods
impl Query
[src]
pub fn new(language: Language, source: &str) -> Result<Self, QueryError>
[src]
Create a new query from a string containing one or more S-expression patterns.
The query is associated with a particular language, and can only be run on syntax nodes parsed with that language.
pub fn start_byte_for_pattern(&self, pattern_index: usize) -> usize
[src]
Get the byte offset where the given pattern starts in the query's source.
pub fn pattern_count(&self) -> usize
[src]
Get the number of patterns in the query.
pub fn capture_names(&self) -> &[String]
[src]
Get the names of the captures used in the query.
pub fn property_predicates(&self, index: usize) -> &[(QueryProperty, bool)]
[src]
Get the properties that are checked for the given pattern index.
pub fn property_settings(&self, index: usize) -> &[QueryProperty]
[src]
Get the properties that are set for the given pattern index.
pub fn disable_capture(&mut self, name: &str)
[src]
Disable a certain capture within a query.
This prevents the capture from being returned in matches, and also avoids any resource usage associated with recording the capture.
Trait Implementations
impl Send for Query
[src]
impl Sync for Query
[src]
impl Drop for Query
[src]
impl PartialEq<Query> for Query
[src]
impl Debug for Query
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,