Start work on a SyntaxMap data structure
This commit is contained in:
parent
6e67448420
commit
f6a817a0f3
7 changed files with 476 additions and 4 deletions
|
@ -608,9 +608,9 @@ where
|
|||
|
||||
impl<'a, F, T, S, U> Iterator for FilterCursor<'a, F, T, U>
|
||||
where
|
||||
F: Fn(&T::Summary) -> bool,
|
||||
F: FnMut(&T::Summary) -> bool,
|
||||
T: Item<Summary = S>,
|
||||
S: Summary<Context = ()>,
|
||||
S: Summary<Context = ()>, //Context for the summary must be unit type, as .next() doesn't take arguments
|
||||
U: Dimension<'a, T::Summary>,
|
||||
{
|
||||
type Item = &'a T;
|
||||
|
@ -621,7 +621,7 @@ where
|
|||
}
|
||||
|
||||
if let Some(item) = self.item() {
|
||||
self.cursor.next_internal(&self.filter_node, &());
|
||||
self.cursor.next_internal(&mut self.filter_node, &());
|
||||
Some(item)
|
||||
} else {
|
||||
None
|
||||
|
|
|
@ -168,6 +168,8 @@ impl<T: Item> SumTree<T> {
|
|||
Cursor::new(self)
|
||||
}
|
||||
|
||||
/// Note: If the summary type requires a non `()` context, then the filter cursor
|
||||
/// that is returned cannot be used with Rust's iterators.
|
||||
pub fn filter<'a, F, U>(&'a self, filter_node: F) -> FilterCursor<F, T, U>
|
||||
where
|
||||
F: FnMut(&T::Summary) -> bool,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue