Integration / Futures

Pantomime provides integration with the futures crate. Futures can be spawned by dispatchers, and their results can be piped to actors.

Futures integration is provided by the futures-support feature, which is enabled by default.

Spawning Futures

Any Dispatcher can spawn Futures and drive them to completion. The following demonstrates how to do this, using the spawn method.

Piping Futures

The pipe_to method can be used to message the result of a Future to an actor. For example:

use pantomime::prelude::*;

// Note: In reality, these would be real futures / actors
let my_actor: ActorRef = ActorRef::empty();
let my_future = future::ok(42);