Future
The future trait
trait SimpleFuture {
type Output;
fn poll(&mut self, wake: fn()) -> Poll<self::Output>;
}
enum Poll<T> {
Ready<T>,
Pending,
}
Future can be advanced by calling the poll
function, that will drive the future towards completion, if future completes, it returns Poll::Ready(result)
, it the future is not able to complete yet, it returns Poll:Pending
and registry wake
to be called once there are data comming. whence wake is called, the executor driving the Future will call poll again.
the executor would know when a particular future could make progress.