Split iced_futures into different backend implementations
This commit is contained in:
parent
5dab5a327e
commit
167be45a7d
19 changed files with 280 additions and 318 deletions
38
futures/src/backend/default.rs
Normal file
38
futures/src/backend/default.rs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
//! A default, cross-platform backend.
|
||||
//!
|
||||
//! - On native platforms, it will use:
|
||||
//! - `backend::native::tokio` when the `tokio` feature is enabled.
|
||||
//! - `backend::native::async-std` when the `async-std` feature is
|
||||
//! enabled.
|
||||
//! - `backend::native::smol` when the `smol` feature is enabled.
|
||||
//! - `backend::native::thread_pool` otherwise.
|
||||
//!
|
||||
//! - On Wasm, it will use `backend::wasm::wasm_bindgen`.
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
mod platform {
|
||||
#[cfg(feature = "tokio")]
|
||||
pub use crate::backend::native::tokio::*;
|
||||
|
||||
#[cfg(all(feature = "async-std", not(feature = "tokio"),))]
|
||||
pub use crate::backend::native::async_std::*;
|
||||
|
||||
#[cfg(all(
|
||||
feature = "smol",
|
||||
not(any(feature = "tokio", feature = "async-std")),
|
||||
))]
|
||||
pub use crate::backend::native::smol::*;
|
||||
|
||||
#[cfg(not(any(
|
||||
feature = "tokio",
|
||||
feature = "async-std",
|
||||
feature = "smol",
|
||||
)))]
|
||||
pub use crate::backend::native::thread_pool::*;
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
mod platform {
|
||||
pub use crate::backend::wasm::wasm_bindgen::*;
|
||||
}
|
||||
|
||||
pub use platform::*;
|
||||
Loading…
Add table
Add a link
Reference in a new issue