diff options
Diffstat (limited to 'src/executor.rs')
-rw-r--r-- | src/executor.rs | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/executor.rs b/src/executor.rs index 59d59a5a..9f3656b1 100644 --- a/src/executor.rs +++ b/src/executor.rs @@ -1,5 +1,5 @@ //! Choose your preferred executor to power your application. -pub use crate::runtime::{executor::Null, Executor}; +pub use crate::runtime::Executor; pub use platform::Default; @@ -7,13 +7,34 @@ pub use platform::Default; mod platform { use iced_futures::{executor, futures}; - #[cfg(feature = "tokio")] + #[cfg(feature = "tokio_old")] + type Executor = executor::TokioOld; + + #[cfg(all(feature = "tokio", not(feature = "tokio_old")))] type Executor = executor::Tokio; - #[cfg(all(not(feature = "tokio"), feature = "async-std"))] + #[cfg(all( + feature = "async-std", + not(any(feature = "tokio_old", feature = "tokio")), + ))] type Executor = executor::AsyncStd; - #[cfg(not(any(feature = "tokio", feature = "async-std")))] + #[cfg(all( + feature = "smol", + not(any( + feature = "tokio_old", + feature = "tokio", + feature = "async-std" + )), + ))] + type Executor = executor::Smol; + + #[cfg(not(any( + feature = "tokio_old", + feature = "tokio", + feature = "async-std", + feature = "smol", + )))] type Executor = executor::ThreadPool; /// A default cross-platform executor. @@ -40,7 +61,7 @@ mod platform { } fn enter<R>(&self, f: impl FnOnce() -> R) -> R { - self.0.enter(f) + super::Executor::enter(&self.0, f) } } } |