diff options
| author | Steven Allen <steven@stebalien.com> | 2020-03-01 14:56:42 -0800 |
|---|---|---|
| committer | Steven Allen <steven@stebalien.com> | 2020-03-01 16:37:52 -0800 |
| commit | 85cbabba63e472a349fcee45c31fe19e956a1610 (patch) | |
| tree | 867dc35ef1b83c7f7dc82c477871009ea44fb4c3 /src | |
| parent | 7ac21e7636f7b3c0eb3e31b13c7087b4de7aa5a9 (diff) | |
| download | rust-85cbabba63e472a349fcee45c31fe19e956a1610.tar.gz rust-85cbabba63e472a349fcee45c31fe19e956a1610.zip | |
Implement nth, last, and count for iter::Copied
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcore/iter/adapters/mod.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libcore/iter/adapters/mod.rs b/src/libcore/iter/adapters/mod.rs index 3b8edc2ad61..dcc1fb13bbc 100644 --- a/src/libcore/iter/adapters/mod.rs +++ b/src/libcore/iter/adapters/mod.rs @@ -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")] |
