Skip to content

Document that IntoIterator allows for for...in sugar #23851

Closed
@frewsxcv

Description

@frewsxcv

http://doc.rust-lang.org/core/iter/trait.IntoIterator.html

I think we should mention somewhere in the docs for IntoIterator that implementing this trait allows one to write:

let my_vec = vec![1, 10, 100];
for i in my_vec { ... }

instead of

let my_vec = vec![1, 10, 100];
for i in my_vec.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