1use crate::{Executor, ExecutorBlocking, JoinHandle};
2use std::future::Future;
3use std::sync::Arc;
4
5impl<E> Executor for Arc<E>
6where
7 E: Executor,
8{
9 fn spawn<F>(&self, future: F) -> JoinHandle<F::Output>
10 where
11 F: Future + Send + 'static,
12 F::Output: Send + 'static,
13 {
14 (**self).spawn(future)
15 }
16}
17
18impl<E> ExecutorBlocking for Arc<E>
19where
20 E: ExecutorBlocking,
21{
22 fn spawn_blocking<F, T>(&self, future: F) -> JoinHandle<T>
23 where
24 F: FnOnce() -> T + Send + 'static,
25 T: Send + 'static,
26 {
27 (**self).spawn_blocking(future)
28 }
29}