Skip to content

Commit

Permalink
impl ExactSizeIterator and DoubleEndedIterator on ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
konstin committed Nov 10, 2024
1 parent 7cec62f commit 5181c98
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions version-ranges/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,18 @@ impl<V> Iterator for RangesIter<V> {
fn next(&mut self) -> Option<Self::Item> {
self.0.next()
}

fn size_hint(&self) -> (usize, Option<usize>) {
(self.0.len(), Some(self.0.len()))
}
}

impl<V> ExactSizeIterator for RangesIter<V> {}

impl<V> DoubleEndedIterator for RangesIter<V> {
fn next_back(&mut self) -> Option<Self::Item> {
self.0.next_back()
}
}

impl<V> IntoIterator for Ranges<V> {
Expand Down

0 comments on commit 5181c98

Please sign in to comment.