We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3bd4af8 commit 37771d4Copy full SHA for 37771d4
src/libcore/iter/mod.rs
@@ -694,6 +694,18 @@ impl<I> Iterator for StepBy<I> where I: Iterator {
694
(f(inner_hint.0), inner_hint.1.map(f))
695
}
696
697
+
698
+ #[inline]
699
+ fn nth(&mut self, mut n: usize) -> Option<Self::Item> {
700
+ if self.first_take {
701
+ if n == 0 {
702
+ self.first_take = false;
703
+ return self.iter.next()
704
+ }
705
+ n -= 1;
706
707
+ self.iter.nth(n * self.step)
708
709
710
711
// StepBy can only make the iterator shorter, so the len will still fit.
0 commit comments