use crate::{Executor, ExecutorBlocking, JoinHandle};
use std::future::Future;
use std::sync::Arc;
impl<E> Executor for Arc<E>
where
E: Executor,
{
fn spawn<F>(&self, future: F) -> JoinHandle<F::Output>
where
F: Future + Send + 'static,
F::Output: Send + 'static,
{
(**self).spawn(future)
}
}
impl<E> ExecutorBlocking for Arc<E>
where
E: ExecutorBlocking,
{
fn spawn_blocking<F, T>(&self, future: F) -> JoinHandle<T>
where
F: FnOnce() -> T + Send + 'static,
T: Send + 'static,
{
(**self).spawn_blocking(future)
}
}