Skip to content

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

Description

@cyqsimon

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-iteratorsArea: IteratorsT-libs-api[DEPRECATED; DO NOT USE]

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions