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 tokio_stream::StreamExt::map_while #4337

Closed
matklad opened this issue Dec 22, 2021 · 0 comments · Fixed by #4351
Closed

Add tokio_stream::StreamExt::map_while #4337

matklad opened this issue Dec 22, 2021 · 0 comments · Fixed by #4351
Labels
A-tokio Area: The main tokio crate C-feature-request Category: A feature request.

Comments

@matklad
Copy link
Contributor

matklad commented Dec 22, 2021

std recently stabilized map_while:

https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html#method.map_while

Makes sense to port it to StreamExt as well for parity. Here's a real-world use-case where this would be useful:

https://github.com/near/nearcore/blob/87685a454ec7f8971558e2b128aa294b8ac37694/chain/network/src/peer_manager/peer_manager_actor.rs#L797-L804

@matklad matklad added A-tokio Area: The main tokio crate C-feature-request Category: A feature request. labels Dec 22, 2021
BraulioVM added a commit to BraulioVM/tokio that referenced this issue Dec 27, 2021
Fixes tokio-rs#4337

Rust 1.57 stabilized the `Iterator::map_while` API. This PR adds the
same functionality to the `StreamExt` trait, to keep parity.
BraulioVM added a commit to BraulioVM/tokio that referenced this issue Dec 30, 2021
Fixes tokio-rs#4337

Rust 1.57 stabilized the `Iterator::map_while` API. This PR adds the
same functionality to the `StreamExt` trait, to keep parity.
taiki-e pushed a commit that referenced this issue Dec 31, 2021
Fixes #4337

Rust 1.57 stabilized the `Iterator::map_while` API. This PR adds the
same functionality to the `StreamExt` trait, to keep parity.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate C-feature-request Category: A feature request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant