Skip to content

Why does StreamExt::filter and StreamExt::filter_map require functions that returns futures #1987

@jannickj

Description

@jannickj

Currently looking at the api spec the functions for StreamExt::filter takes a function that must return a future, however in 99% of cases you just want to filter on the data, so why needlessly bloat the code with future::ready, instead of having a dedicated function if this is really necessary (which i doubt).

I can understand it being useful to have a function which takes futures, but filter and filter_map are very unexpected to require futures.

It just feels like someone was a bit trigger happy on the merge button.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions