Skip to content

Implement std::iter::Iterator for arrays? #43946

Closed
@mqudsi

Description

@mqudsi

Is it possible to implement a zero-cost, safe, and doesn't-conflict-with-anything-else std::iter::Iterator for arrays, such that it is no longer required to called .iter() to get an iterator out of an array?

e.g. is it possible to use

for value in ["foo", "bar"] {
   ....
}

instead of needing to manually add the .iter():

for value in ["foo", "bar"].iter() {
    ....
}

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