Skip to content

replace most internal iterators with external iterators #6978

@thestinger

Description

@thestinger

The only reason to prefer internal iterators is the difficulty of implementing an external one for recursive data types and often for mutable iterators. We can still provide adaptors for composing internal iterators (iter.rs) but there's no need to provide internal iterators ourselves side-by-side with external iterators.

I think we should throw out the dozens of internal iterators we have on str and vec since they already have a mutable and immutable external iterator. We just need iterators for reverse traversal and the internal ones will be entirely redundant.

For example, there's no need for hardcoded internal iterators like each2 when we have xs.zip(ys) for any two arbitrary iterators - not just two vectors.

See: https://mail.mozilla.org/pipermail/rust-dev/2013-June/004364.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-cleanupCategory: PRs that clean code up or issues documenting cleanup.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions