Skip to content

Commit 25091ed

Browse files
authored
Rollup merge of rust-lang#69625 - Stebalien:feat/iter-copy-specialize, r=KodrAus
Implement nth, last, and count for iter::Copied Implement nth, last and count for iter::Copied.
2 parents d7f0b88 + 85cbabb commit 25091ed

File tree

1 file changed

+12
-0
lines changed
  • src/libcore/iter/adapters

1 file changed

+12
-0
lines changed

src/libcore/iter/adapters/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,18 @@ where
200200
{
201201
self.it.fold(init, copy_fold(f))
202202
}
203+
204+
fn nth(&mut self, n: usize) -> Option<T> {
205+
self.it.nth(n).copied()
206+
}
207+
208+
fn last(self) -> Option<T> {
209+
self.it.last().copied()
210+
}
211+
212+
fn count(self) -> usize {
213+
self.it.count()
214+
}
203215
}
204216

205217
#[stable(feature = "iter_copied", since = "1.36.0")]

0 commit comments

Comments
 (0)