Skip to content

Add a FilterMap operator #355

Open
Open
@Kixiron

Description

@Kixiron

This'd be a nice ergonomic tweak, an operator in the style of Iterator::filter_map() would be really great. Currently there's a somewhat strange workaround using .flat_map(), e.g.

stream.flat_map(|foo| {
    if foo.bar() {
        Some(foo.baz)
    } else {
        None
    }
})

and while this would functionally be nearly identical, the FilterMap operator could likely specialize somewhat since it only has to handle a single output value

Metadata

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