Add smol async runtime

This commit is contained in:
Jayce Fayne 2021-01-13 01:48:35 +01:00
parent 92d647d1a6
commit b2415eee61
8 changed files with 104 additions and 11 deletions

View file

@ -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(all(
not(any(feature = "tokio_old", feature = "tokio")),
feature = "async-std"
))]
#[cfg(feature = "async-std")]
type Executor = executor::AsyncStd;
#[cfg(all(
not(any(
feature = "tokio_old",
feature = "tokio",
feature = "async-std"
)),
feature = "smol"
))]
type Executor = executor::Smol;
#[cfg(not(any(
feature = "tokio_old",
feature = "tokio",
feature = "async-std"
feature = "async-std",
feature = "smol",
)))]
type Executor = executor::ThreadPool;

View file

@ -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;