diff options
Diffstat (limited to 'futures/src/runtime')
-rw-r--r-- | futures/src/runtime/executor.rs | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/futures/src/runtime/executor.rs b/futures/src/runtime/executor.rs deleted file mode 100644 index eec5e231..00000000 --- a/futures/src/runtime/executor.rs +++ /dev/null @@ -1,27 +0,0 @@ -use futures::Future; - -pub trait Executor { - fn spawn(&self, future: impl Future<Output = ()> + Send + 'static); - - fn enter<R>(&self, f: impl FnOnce() -> R) -> R { - f() - } -} - -#[cfg(feature = "thread-pool")] -impl Executor for futures::executor::ThreadPool { - fn spawn(&self, future: impl Future<Output = ()> + Send + 'static) { - self.spawn_ok(future); - } -} - -#[cfg(feature = "tokio")] -impl Executor for tokio::runtime::Runtime { - fn spawn(&self, future: impl Future<Output = ()> + Send + 'static) { - let _ = tokio::runtime::Runtime::spawn(self, future); - } - - fn enter<R>(&self, f: impl FnOnce() -> R) -> R { - tokio::runtime::Runtime::enter(self, f) - } -} |