smol-rs / futures-lite

Futures, streams, and async I/O combinators.
Apache License 2.0
439 stars 25 forks source link

Add "map" and "chain" to the FutureExt trait #46

Closed notgull closed 2 years ago

notgull commented 3 years ago

Feels like a relatively trivial to implement, yet relatively important thing to leave out. This adds two methods to the FutureExt trait: map and chain. map waits for the future to finish and then applies a closure to the result, while chain waits for one future to finish and then uses a closure to generate another future that is then polled.

taiki-e commented 3 years ago

Thanks for the PR!

These can be written very simply using async-await, so I think they do not match the policy of futures-lite.

notgull commented 2 years ago

These can be written very simply using async-await, so I think they do not match the policy of futures-lite.

Fair enough. I'll close this PR.