Rollup merge of #69625 - Stebalien:feat/iter-copy-specialize, r=KodrAus

Implement nth, last, and count for iter::Copied

Implement nth, last and count for iter::Copied.
This commit is contained in:
Mazdak Farrokhzad 2020-03-11 10:36:22 +01:00 committed by GitHub
commit 25091ed9b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -200,6 +200,18 @@ where
{
self.it.fold(init, copy_fold(f))
}
fn nth(&mut self, n: usize) -> Option<T> {
self.it.nth(n).copied()
}
fn last(self) -> Option<T> {
self.it.last().copied()
}
fn count(self) -> usize {
self.it.count()
}
}
#[stable(feature = "iter_copied", since = "1.36.0")]