pub trait Query {
type Match<'query, 'tree: 'query>: QueryMatch<'query, 'tree>;
type Capture<'query, 'tree: 'query>: QueryCapture<'query, 'tree>;
// Required methods
fn as_str(&self) -> &'static str;
fn raw(&self) -> &'static Query;
unsafe fn wrap_match<'query, 'tree>(
&self,
match: QueryMatch<'query, 'tree>,
) -> Self::Match<'query, 'tree>;
unsafe fn wrap_match_ref<'m, 'query, 'tree>(
&self,
match: &'m QueryMatch<'query, 'tree>,
) -> &'m Self::Match<'query, 'tree>;
unsafe fn wrap_capture<'query, 'tree: 'query>(
&self,
capture: QueryCapture<'tree>,
) -> Self::Capture<'query, 'tree>;
}Expand description
A query which can generate type-safe matches and captures, which contain typed nodes
Required Associated Types§
Sourcetype Match<'query, 'tree: 'query>: QueryMatch<'query, 'tree>
type Match<'query, 'tree: 'query>: QueryMatch<'query, 'tree>
A match of this typed query (runtime pattern index)
Sourcetype Capture<'query, 'tree: 'query>: QueryCapture<'query, 'tree>
type Capture<'query, 'tree: 'query>: QueryCapture<'query, 'tree>
An capture of this typed query (runtime capture index)
Required Methods§
Sourceunsafe fn wrap_match<'query, 'tree>(
&self,
match: QueryMatch<'query, 'tree>,
) -> Self::Match<'query, 'tree>
unsafe fn wrap_match<'query, 'tree>( &self, match: QueryMatch<'query, 'tree>, ) -> Self::Match<'query, 'tree>
Wrap a tree-sitter QueryMatch which you know came from this query.
§Safety
The match must have come from this query.
Sourceunsafe fn wrap_match_ref<'m, 'query, 'tree>(
&self,
match: &'m QueryMatch<'query, 'tree>,
) -> &'m Self::Match<'query, 'tree>
unsafe fn wrap_match_ref<'m, 'query, 'tree>( &self, match: &'m QueryMatch<'query, 'tree>, ) -> &'m Self::Match<'query, 'tree>
Wrap a reference to a tree-sitter QueryMatch which you know came from this query.
§Safety
The match must have come from this query.
Sourceunsafe fn wrap_capture<'query, 'tree: 'query>(
&self,
capture: QueryCapture<'tree>,
) -> Self::Capture<'query, 'tree>
unsafe fn wrap_capture<'query, 'tree: 'query>( &self, capture: QueryCapture<'tree>, ) -> Self::Capture<'query, 'tree>
Wrap a tree-sitter QueryCapture which you know came from this query.
§Safety
The capture must have come from this query.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.