Skip to content

Commit d70a7d8

Browse files
committed
impl ExactSizeIterator and DoubleEndedIterator on ranges
1 parent 38d11ae commit d70a7d8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

version-ranges/src/lib.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,18 @@ impl<V> Iterator for RangesIter<V> {
855855
fn next(&mut self) -> Option<Self::Item> {
856856
self.0.next()
857857
}
858+
859+
fn size_hint(&self) -> (usize, Option<usize>) {
860+
(self.0.len(), Some(self.0.len()))
861+
}
862+
}
863+
864+
impl<V> ExactSizeIterator for RangesIter<V> {}
865+
866+
impl<V> DoubleEndedIterator for RangesIter<V> {
867+
fn next_back(&mut self) -> Option<Self::Item> {
868+
self.0.next_back()
869+
}
858870
}
859871

860872
impl<V> IntoIterator for Ranges<V> {

0 commit comments

Comments
 (0)