pub enum Async<Item> {
Ready(Item),
NotReady,
DidWork,
NothingToDo,
}
Expand description
Return type of a component of a future or stream, indicating whether a value is ready, or if not, what actions were taken.
Variants§
Ready(Item)
We have a value for the main loop to return immediately.
NotReady
One of our inner futures returned futures::Async::NotReady
. If all
of our other components return either NothingToDo
or NotReady
,
then our overall future should return NotReady
and wait to be polled
again.
DidWork
We did some work (moved our internal state closer to being ready to return a value), but we aren’t ready to return a value yet. We should re-run all of the poll functions to see if the state modification made any of them also able to make progress.
NothingToDo
We didn’t poll any inner futures or otherwise change our internal
state at all, so rerunning is unlikely to make progress. If all
components return either NothingToDo
or NotReady
(and at least one
returns NotReady
), then we should just return NotReady
and wait to
be polled again. It is an error (panic) for all component poll methods
to return NothingToDo
.