smol-rs / futures-lite

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

add now_or_never #32

Open dvc94ch opened 3 years ago

dvc94ch commented 3 years ago

this has stopped me from using futures-lite a couple of times now. incredibly useful function.

Kestrer commented 3 years ago

It currently exists as futures_lite::future::poll_once, although it's not a method like .now_or_never().

dvc94ch commented 3 years ago

No, that's not the same. It requires you to construct a waker, and if you look at the futures NoopWaker it's about 200loc.

Kestrer commented 3 years ago

Oh, sorry, I didn't realize. But it can still be useful when you are already in an async context, which is often the case.