Skip to content

Generics confusion in docs #15977

Closed
Closed
@mvdnes

Description

@mvdnes

Description

Recently I was looking in the docs for FilterMap, where it says:

fn filter_map<B>(|B|: 'r -> Option<B>) -> FilterMap<'r, B, B, FilterMap<'a, A, B, T>>

However, it seems that not all B's must be the same type. The definition of filter_map is namely:

fn filter_map<'r, B>(self, f: |A|: 'r -> Option<B>) -> FilterMap<'r, A, B, Self>

I believe this is due to the fact that the function filter_map is implemented for Iterator<A> and that FilterMap implements Iterator<B>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions