A futures executor as an event source
Only available with the
executor cargo feature of
This executor is intended for light futures, which will be polled as part of your event loop. Such futures may be waiting for IO, or for some external computation on an other thread for example.
You can create a new executor using the
executor function, which creates a pair
(Executor<T>, Scheduler<T>) to handle futures that all evaluate to type
executor should be inserted into your event loop, and will yield the return values of
the futures as they finish into your callback. The scheduler can be cloned and used
to send futures to be executed into the executor. A generic executor can be obtained
T = () and letting futures handle the forwarding of their return values
(if any) by their own means.
Note: The futures must have their own means of being woken up, as this executor is,
by itself, not I/O aware. See
for that, or you can use some other mechanism if you prefer.