Skip to content

Commit

Permalink
Rollup merge of #69625 - Stebalien:feat/iter-copy-specialize, r=KodrAus
Browse files Browse the repository at this point in the history
Implement nth, last, and count for iter::Copied

Implement nth, last and count for iter::Copied.
  • Loading branch information
Centril authored Mar 11, 2020
2 parents d7f0b88 + 85cbabb commit 25091ed
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/libcore/iter/adapters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down

0 comments on commit 25091ed

Please sign in to comment.