Closed ComputerDruid closed 3 years ago
I'll also note that I'm generally confused about why ready!
is useful for this reason; presumably it is useful because I remember seeing it in code I've read a bunch, but I haven't tried to hand-write very many futures myself.
Indeed, you're right. Now I copied the docs from std::task::ready!
and published a new version: https://doc.rust-lang.org/nightly/std/task/macro.ready.html
Nice, perfect.
https://docs.rs/futures-lite/1.11.1/futures_lite/macro.ready.html#examples
Lists an example usage of:
I'm pretty sure this is incorrect because if
a.poll()
returnsReady
butb.poll()
returnsPending
,a
will getpoll()
ed twice, which isn't allowed: https://doc.rust-lang.org/std/future/trait.Future.html#panics