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

This commit is contained in:
Steven Allen 2020-03-01 14:56:42 -08:00
parent 7ac21e7636
commit 85cbabba63

View File

@ -173,6 +173,18 @@ impl<'a, I, T: 'a> Iterator for Copied<I>
{
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")]