iced-yoda/futures/src/lib.rs

70 lines
1.9 KiB
Rust
Raw Normal View History

2020-01-20 09:49:17 +01:00
//! Asynchronous tasks for GUI programming, inspired by Elm.
2020-11-26 07:22:03 +01:00
//!
//! ![The foundations of the Iced ecosystem](https://github.com/hecrj/iced/blob/0525d76ff94e828b7b21634fa94a747022001c83/docs/graphs/foundations.png?raw=true)
2020-01-20 09:49:17 +01:00
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#![deny(unused_results)]
#![forbid(unsafe_code)]
#![forbid(rust_2018_idioms)]
2020-04-04 02:25:40 +01:00
#![cfg_attr(docsrs, feature(doc_cfg))]
pub use futures;
mod command;
mod runtime;
pub mod executor;
pub mod subscription;
2020-04-30 05:51:41 +02:00
#[cfg(all(
2021-01-13 01:48:35 +01:00
any(
feature = "tokio",
feature = "tokio_old",
feature = "async-std",
feature = "smol"
),
2020-04-30 05:51:41 +02:00
not(target_arch = "wasm32")
))]
2021-01-13 01:48:35 +01:00
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "tokio",
feature = "async-std",
feature = "smol"
)))
)]
pub mod time;
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>;