From b2415eee61063d5c2b220d7b7a513d1952ce2be1 Mon Sep 17 00:00:00 2001 From: Jayce Fayne Date: Wed, 13 Jan 2021 01:48:35 +0100 Subject: Add `smol` async runtime --- src/executor.rs | 30 ++++++++++++++++++++++++------ src/lib.rs | 8 +++++++- 2 files changed, 31 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/executor.rs b/src/executor.rs index 0333bc1d..2c6d9ec0 100644 --- a/src/executor.rs +++ b/src/executor.rs @@ -7,22 +7,40 @@ pub use platform::Default; mod platform { use iced_futures::{executor, futures}; - #[cfg(feature = "tokio_old")] + #[cfg(all( + not(any(feature = "tokio", feature = "smol", feature = "async-std")), + feature = "tokio_old" + ))] type Executor = executor::TokioOld; - #[cfg(all(not(feature = "tokio_old"), feature = "tokio"))] + #[cfg(all( + not(any( + feature = "tokio_old", + feature = "smol", + feature = "async-std" + )), + feature = "tokio" + ))] type Executor = executor::Tokio; + #[cfg(feature = "async-std")] + type Executor = executor::AsyncStd; + #[cfg(all( - not(any(feature = "tokio_old", feature = "tokio")), - feature = "async-std" + not(any( + feature = "tokio_old", + feature = "tokio", + feature = "async-std" + )), + feature = "smol" ))] - type Executor = executor::AsyncStd; + type Executor = executor::Smol; #[cfg(not(any( feature = "tokio_old", feature = "tokio", - feature = "async-std" + feature = "async-std", + feature = "smol", )))] type Executor = executor::ThreadPool; diff --git a/src/lib.rs b/src/lib.rs index 3578ea82..dedcac7a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -191,7 +191,12 @@ pub mod widget; pub mod window; #[cfg(all( - any(feature = "tokio", feature = "tokio_old", feature = "async-std"), + any( + feature = "tokio", + feature = "tokio_old", + feature = "async-std", + feature = "smol" + ), not(target_arch = "wasm32") ))] #[cfg_attr( @@ -200,6 +205,7 @@ pub mod window; feature = "tokio", feature = "tokio_old", feature = "async-std" + feature = "smol" ))) )] pub mod time; -- cgit From a42a0844c2ffc51e117304a5d08e4a0fb52adac7 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 15 Jan 2021 18:31:30 +0100 Subject: Keep old behavior for `Executor` feature flags --- src/executor.rs | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/executor.rs b/src/executor.rs index 2c6d9ec0..9f3656b1 100644 --- a/src/executor.rs +++ b/src/executor.rs @@ -7,32 +7,25 @@ pub use platform::Default; mod platform { use iced_futures::{executor, futures}; - #[cfg(all( - not(any(feature = "tokio", feature = "smol", feature = "async-std")), - feature = "tokio_old" - ))] + #[cfg(feature = "tokio_old")] type Executor = executor::TokioOld; - #[cfg(all( - not(any( - feature = "tokio_old", - feature = "smol", - feature = "async-std" - )), - feature = "tokio" - ))] + #[cfg(all(feature = "tokio", not(feature = "tokio_old")))] type Executor = executor::Tokio; - #[cfg(feature = "async-std")] + #[cfg(all( + feature = "async-std", + not(any(feature = "tokio_old", feature = "tokio")), + ))] type Executor = executor::AsyncStd; #[cfg(all( + feature = "smol", not(any( feature = "tokio_old", feature = "tokio", feature = "async-std" )), - feature = "smol" ))] type Executor = executor::Smol; -- cgit