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

Closed
cyqsimon opened this issue Oct 18, 2024 · 1 comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools A-iterators Area: Iterators T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

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
@lolbinarycat lolbinarycat added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. A-iterators Area: Iterators labels Oct 21, 2024
@cyqsimon
Copy link
Contributor Author

Closed by #131858.

@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 25, 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 A-iterators Area: Iterators T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants