Module calloop::futures

source ·
Expand description

A futures executor as an event source

Only available with the executor cargo feature of calloop.

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 T. The 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 by choosing 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 LoopHandle::adapt_io for that, or you can use some other mechanism if you prefer.

Structs§

  • A future executor as an event source
  • Error generated when trying to schedule a future after the executor was destroyed.
  • A scheduler to send futures to an executor

Enums§

  • An error arising from processing events in an async executor event source.

Functions§

  • Create a new executor, and its associated scheduler