-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Document that .iter() has an element type of &T #25928
Copy link
Copy link
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.
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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
The docs for Vec::iter show the following type:
As a result, I was puzzled that the following doesn't work:
It turns out that that
Iterimplements an iterator with element type &T. On the Iter docs page we seetype Item = &'a Tbut it's easy to overlook.I think it would be worth adding a line to
Vec::iter's documentation to say:This is the approach taken in itertools docs (example) and I think it helps significantly.