Skip to content

Always implement ExactSizeIterator for std::iter::Take #50057

Closed
@pitdicker

Description

@pitdicker

Currently std::iter::Take only implements ExactSizeIterator if its parent iterator implements that. But Take knows how many elements it will return at most, so I think it makes sense if it would always implement ExactSizeIterator.

It would not be correct if the parent iterator produces less items, but this trait is only a best effort to help optimizations, right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions