diff --git a/lib/binding_rust/lib.rs b/lib/binding_rust/lib.rs index a0b757d5..17c91289 100644 --- a/lib/binding_rust/lib.rs +++ b/lib/binding_rust/lib.rs @@ -1587,7 +1587,7 @@ impl Query { } } -impl QueryCursor { +impl<'a> QueryCursor { /// Create a new cursor for executing a given query. /// /// The cursor stores the state that is needed to iteratively search for matches. @@ -1606,12 +1606,12 @@ impl QueryCursor { /// 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 matches<'a, T: AsRef<[u8]>>( + pub fn matches<'tree: 'a, T: AsRef<[u8]>>( &'a mut self, query: &'a Query, - node: Node<'a>, - mut text_callback: impl FnMut(Node<'a>) -> T + 'a, - ) -> impl Iterator> + 'a { + node: Node<'tree>, + mut text_callback: impl FnMut(Node<'tree>) -> T + 'a, + ) -> impl Iterator> + 'a { let ptr = self.0.as_ptr(); unsafe { ffi::ts_query_cursor_exec(ptr, query.ptr.as_ptr(), node.0) }; std::iter::from_fn(move || loop { @@ -1633,7 +1633,7 @@ impl QueryCursor { /// /// This is useful if don't care about which pattern matched, and just want a single, /// ordered sequence of captures. - pub fn captures<'a, T: AsRef<[u8]>>( + pub fn captures>( &'a mut self, query: &'a Query, node: Node<'a>,