diff options
author | 2020-03-26 14:53:58 +0100 | |
---|---|---|
committer | 2020-03-26 14:53:58 +0100 | |
commit | ec1f34ccea92b049a462664703351fe7e094fb02 (patch) | |
tree | 41f9fb6147443207de98a05fd171c5971b0edeeb /futures | |
parent | 643fa18cae19fa1418a23b652b6b4b8bf8ef79fc (diff) | |
download | iced-ec1f34ccea92b049a462664703351fe7e094fb02.tar.gz iced-ec1f34ccea92b049a462664703351fe7e094fb02.tar.bz2 iced-ec1f34ccea92b049a462664703351fe7e094fb02.zip |
Add `BoxFutures` and `BoxStream` to `iced_futures`
Diffstat (limited to 'futures')
-rw-r--r-- | futures/src/lib.rs | 28 |
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>; |