pub trait Executor {
// Required method
fn exec(&self, future: Pin<Box<dyn Future<Output = ()> + Send>>);
}
Expand description
Implemented on objects that can run a Future
in the background.
Note: While it may be tempting to implement this trait on types such as
futures::stream::FuturesUnordered
, please note that passing anExecutor
is optional, and thatFuturesUnordered
(or a similar struct) will automatically be used as fallback by libp2p. TheExecutor
trait should therefore only be about runningFuture
s on a separate task.