pub trait Executor:
Clone
+ Send
+ Sync
+ 'static {
// Required method
fn spawn<F>(&self, future: F) -> JoinHandle<F::Output>
where F: Future + Send + 'static,
F::Output: Send + 'static;
}Expand description
Trait for executors that can spawn futures.
This trait abstracts over different execution strategies, allowing services to be run on dedicated runtimes, thread pools, or with different spawning strategies.
§Example
use tower_resilience_executor::Executor;
use tokio::runtime::Handle;
// Tokio Handle implements Executor
let handle = Handle::current();Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl Executor for Handle
Executor implementation for tokio’s runtime Handle.
impl Executor for Handle
Executor implementation for tokio’s runtime Handle.
This spawns futures as new tasks on the tokio runtime.