Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repeat_n's documentation lists impl ExactSizeIterator as a difference with repeat + Iterator::take, which is no longer the case #131872

Open
cyqsimon opened this issue Oct 18, 2024 · 0 comments
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools needs-triage This issue may need triage. Remove it if it has been sufficiently triaged.

Comments

@cyqsimon
Copy link
Contributor

Location

https://doc.rust-lang.org/nightly/std/iter/fn.repeat_n.html

Summary

The newly stabalised std::iter::repeat_n states:

This is very similar to using repeat() with Iterator::take(), but there are two differences:

  • repeat_n() can return the original value, rather than always cloning.
  • repeat_n() produces an ExactSizeIterator.

But the second item is no longer true, since impl ExactSizeIterator for Take<Repeat<T>> and impl ExactSizeIterator for Take<RepeatWith<F>> now exist and are stable.

@cyqsimon cyqsimon added the A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools label Oct 18, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools needs-triage This issue may need triage. Remove it if it has been sufficiently triaged.
Projects
None yet
Development

No branches or pull requests

2 participants