Allow QueryCursor::matches' text_callback to return any AsRef<[u8]> (#488)
This commit is contained in:
parent
ce633a85c6
commit
8e6220a0c5
1 changed files with 2 additions and 2 deletions
|
|
@ -1387,11 +1387,11 @@ 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>(
|
||||
pub fn matches<'a, T: AsRef<[u8]>>(
|
||||
&mut self,
|
||||
query: &'a Query,
|
||||
node: Node<'a>,
|
||||
mut text_callback: impl FnMut(Node<'a>) -> &[u8] + 'a,
|
||||
mut text_callback: impl FnMut(Node<'a>) -> T + 'a,
|
||||
) -> impl Iterator<Item = QueryMatch<'a>> + 'a {
|
||||
let ptr = self.0.as_ptr();
|
||||
unsafe { ffi::ts_query_cursor_exec(ptr, query.ptr.as_ptr(), node.0) };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue