summaryrefslogtreecommitdiffstats
path: root/futures/src/lib.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-03-26 14:53:58 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-03-26 14:53:58 +0100
commitec1f34ccea92b049a462664703351fe7e094fb02 (patch)
tree41f9fb6147443207de98a05fd171c5971b0edeeb /futures/src/lib.rs
parent643fa18cae19fa1418a23b652b6b4b8bf8ef79fc (diff)
downloadiced-ec1f34ccea92b049a462664703351fe7e094fb02.tar.gz
iced-ec1f34ccea92b049a462664703351fe7e094fb02.tar.bz2
iced-ec1f34ccea92b049a462664703351fe7e094fb02.zip
Add `BoxFutures` and `BoxStream` to `iced_futures`
Diffstat (limited to 'futures/src/lib.rs')
-rw-r--r--futures/src/lib.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/futures/src/lib.rs b/futures/src/lib.rs
index c25c0853..79178931 100644
--- a/futures/src/lib.rs
+++ b/futures/src/lib.rs
@@ -16,3 +16,31 @@ pub use command::Command;
pub use executor::Executor;
pub use runtime::Runtime;
pub use subscription::Subscription;
+
+/// A boxed static future.
+///
+/// - On native platforms, it needs a `Send` requirement.
+/// - On the Web platform, it does not need a `Send` requirement.
+#[cfg(not(target_arch = "wasm32"))]
+pub type BoxFuture<T> = futures::future::BoxFuture<'static, T>;
+
+/// A boxed static future.
+///
+/// - On native platforms, it needs a `Send` requirement.
+/// - On the Web platform, it does not need a `Send` requirement.
+#[cfg(target_arch = "wasm32")]
+pub type BoxFuture<T> = futures::future::LocalBoxFuture<'static, T>;
+
+/// A boxed static stream.
+///
+/// - On native platforms, it needs a `Send` requirement.
+/// - On the Web platform, it does not need a `Send` requirement.
+#[cfg(not(target_arch = "wasm32"))]
+pub type BoxStream<T> = futures::stream::BoxStream<'static, T>;
+
+/// A boxed static stream.
+///
+/// - On native platforms, it needs a `Send` requirement.
+/// - On the Web platform, it does not need a `Send` requirement.
+#[cfg(target_arch = "wasm32")]
+pub type BoxStream<T> = futures::stream::LocalBoxStream<'static, T>;