Skip to content

Add StreamExt::map_while #2853

@nanoqsh

Description

@nanoqsh

The proposal to add a similar method from std map_while for stream.
This would be convenient to reduce this:

stream.map(|x| u32::checked_div(16, x))
    .take_while(|x| future::ready(x.is_some()))
    .map(|x| x.unwrap())

to this:

stream.map_while(|x| future::ready(u32::checked_div(16, x)))

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions