pub struct Query { /* private fields */ }
Expand description

A set of patterns that match nodes in a syntax tree.

Implementations

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. References to Queries can be shared between multiple threads.

Get the byte offset where the given pattern starts in the query’s source.

Get the number of patterns in the query.

Get the names of the captures used in the query.

Get the quantifiers of the captures used in the query.

Get the index for a given capture name.

Get the properties that are checked for the given pattern index.

This includes predicates with the operators is? and is-not?.

Get the properties that are set for the given pattern index.

This includes predicates with the operator set!.

Get the other user-defined predicates associated with the given index.

This includes predicate with operators other than:

  • match?
  • eq? and not-eq?
  • is? and is-not?
  • set!

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.

Disable a certain pattern within a query.

This prevents the pattern from matching, and also avoids any resource usage associated with the pattern.

Check if a given pattern within a query has a single root node.

Check if a given pattern within a query has a single root node.

Check if a given step in a query is ‘definite’.

A query step is ‘definite’ if its parent pattern will be guaranteed to match successfully once it reaches the step.

Trait Implementations

Formats the value using the given formatter. Read more
Executes the destructor for this type. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.