Skip to content

Commit

Permalink
feat(cordyceps): add FusedIterator impls for List iterators (#315)
Browse files Browse the repository at this point in the history
This enables additional optimizations if these iterators are guaranteed
to never return `Some` again after returning `None` once, which they
are.
  • Loading branch information
hawkw authored Sep 8, 2022
1 parent a0c5fb8 commit 06179e2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cordyceps/src/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1247,6 +1247,8 @@ impl<'list, T: Linked<Links<T>> + ?Sized> DoubleEndedIterator for Iter<'list, T>
}
}

impl<'list, T: Linked<Links<T>> + ?Sized> iter::FusedIterator for Iter<'list, T> {}

// === impl IterMut ====

impl<'list, T: Linked<Links<T>> + ?Sized> Iterator for IterMut<'list, T> {
Expand Down Expand Up @@ -1314,6 +1316,8 @@ impl<'list, T: Linked<Links<T>> + ?Sized> DoubleEndedIterator for IterMut<'list,
}
}

impl<'list, T: Linked<Links<T>> + ?Sized> iter::FusedIterator for IterMut<'list, T> {}

// === impl IntoIter ===

impl<T: Linked<Links<T>> + ?Sized> fmt::Debug for IntoIter<T> {
Expand Down Expand Up @@ -1350,6 +1354,8 @@ impl<T: Linked<Links<T>> + ?Sized> ExactSizeIterator for IntoIter<T> {
}
}

impl<T: Linked<Links<T>> + ?Sized> iter::FusedIterator for IntoIter<T> {}

// === impl DrainFilter ===

impl<T, F> Iterator for DrainFilter<'_, T, F>
Expand Down

0 comments on commit 06179e2

Please sign in to comment.