Future

The future trait

  1. trait SimpleFuture {
  2. type Output;
  3. fn poll(&mut self, wake: fn()) -> Poll<self::Output>;
  4. }
  5. enum Poll<T> {
  6. Ready<T>,
  7. Pending,
  8. }

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.