summaryrefslogtreecommitdiffstats
path: root/futures/src/backend/default.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-01-28 18:24:07 +0700
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-01-28 21:37:17 +0700
commit167be45a7db7c1f60a79116766bdf38300429c6a (patch)
tree5af48807c8d90a73775fef68a51ae549880aa388 /futures/src/backend/default.rs
parent5dab5a327ef643ee38ac3e42ab35212fff445631 (diff)
downloadiced-167be45a7db7c1f60a79116766bdf38300429c6a.tar.gz
iced-167be45a7db7c1f60a79116766bdf38300429c6a.tar.bz2
iced-167be45a7db7c1f60a79116766bdf38300429c6a.zip
Split `iced_futures` into different `backend` implementations
Diffstat (limited to 'futures/src/backend/default.rs')
-rw-r--r--futures/src/backend/default.rs38
1 files changed, 38 insertions, 0 deletions
diff --git a/futures/src/backend/default.rs b/futures/src/backend/default.rs
new file mode 100644
index 00000000..76264f55
--- /dev/null
+++ b/futures/src/backend/default.rs
@@ -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::*;