Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add StreamExt::map_while #2853

Open
nanoqsh opened this issue Apr 26, 2024 · 0 comments
Open

Add StreamExt::map_while #2853

nanoqsh opened this issue Apr 26, 2024 · 0 comments
Labels
A-stream Area: futures::stream C-feature-request S-needs-implementation Status: Implementation work is needed.

Comments

@nanoqsh
Copy link

nanoqsh commented Apr 26, 2024

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)))
@taiki-e taiki-e added C-feature-request A-stream Area: futures::stream S-needs-implementation Status: Implementation work is needed. labels May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-stream Area: futures::stream C-feature-request S-needs-implementation Status: Implementation work is needed.
Projects
None yet
Development

No branches or pull requests

2 participants