Skip to content

Commit 5181c98

Browse files
committed
impl ExactSizeIterator and DoubleEndedIterator on ranges
1 parent 7cec62f commit 5181c98

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
@@ -836,6 +836,18 @@ impl<V> Iterator for RangesIter<V> {
836836
fn next(&mut self) -> Option<Self::Item> {
837837
self.0.next()
838838
}
839+
840+
fn size_hint(&self) -> (usize, Option<usize>) {
841+
(self.0.len(), Some(self.0.len()))
842+
}
843+
}
844+
845+
impl<V> ExactSizeIterator for RangesIter<V> {}
846+
847+
impl<V> DoubleEndedIterator for RangesIter<V> {
848+
fn next_back(&mut self) -> Option<Self::Item> {
849+
self.0.next_back()
850+
}
839851
}
840852

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

0 commit comments

Comments
 (0)