-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.Relevant to the dev-tools subteam, which will review and decide on the PR/issue.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Description
The docs for Vec::iter show the following type:
fn iter(&self) -> Iter<T>
As a result, I was puzzled that the following doesn't work:
let bar: Vec<&str> = vec!["a", "b", "c", "b"].iter().collect();
It turns out that that Iter
implements an iterator with element type &T. On the Iter docs page we see type Item = &'a T
but it's easy to overlook.
I think it would be worth adding a line to Vec::iter
's documentation to say:
Iterator element type is &T.
This is the approach taken in itertools docs (example) and I think it helps significantly.
Metadata
Metadata
Assignees
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.Relevant to the dev-tools subteam, which will review and decide on the PR/issue.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.