Skip to content

Mention type placeholders in the manual and tutorial #12891

Closed
@Kimundi

Description

#12764 landed, but didn't include docs for the feature.

The manual and tutorial should mention it in the context of type inference, and give a proper explanation:

  • _ in a type is a "type placeholder" and has the meaning "infer this type".
  • Type placeholders are not allowed in item signatures, because global inference is not allowed by design.
  • Patterns like Vec<_> are called "partial type hints" and are useful in combination with things like collect() on iterators.

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