Skip to content

Commit 85cbabb

Browse files
committed
Implement nth, last, and count for iter::Copied
1 parent 7ac21e7 commit 85cbabb

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

+12
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,18 @@ impl<'a, I, T: 'a> Iterator for Copied<I>
173173
{
174174
self.it.fold(init, copy_fold(f))
175175
}
176+
177+
fn nth(&mut self, n: usize) -> Option<T> {
178+
self.it.nth(n).copied()
179+
}
180+
181+
fn last(self) -> Option<T> {
182+
self.it.last().copied()
183+
}
184+
185+
fn count(self) -> usize {
186+
self.it.count()
187+
}
176188
}
177189

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

0 commit comments

Comments
 (0)