2020-01-20 09:49:17 +01:00
//! Asynchronous tasks for GUI programming, inspired by Elm.
2020-11-26 07:22:03 +01:00
//!
2021-12-23 09:34:37 +02:00
//! 
2021-12-08 08:04:46 +01:00
#![ doc(
2021-12-09 15:10:38 +07:00
html_logo_url = " https://raw.githubusercontent.com/iced-rs/iced/9ab6923e943f784985e9ef9ca28b10278297225d/docs/logo.svg "
2021-12-08 08:04:46 +01:00
) ]
2022-07-09 18:03:59 +02:00
#![ deny(
missing_debug_implementations ,
missing_docs ,
unused_results ,
clippy ::extra_unused_lifetimes ,
clippy ::from_over_into ,
clippy ::needless_borrow ,
clippy ::new_without_default ,
clippy ::useless_conversion
) ]
#![ forbid(unsafe_code, rust_2018_idioms) ]
#![ allow(clippy::inherent_to_string, clippy::type_complexity) ]
2020-04-04 02:25:40 +01:00
#![ cfg_attr(docsrs, feature(doc_cfg)) ]
2020-01-20 04:47:36 +01:00
pub use futures ;
2020-01-19 10:17:08 +01:00
mod command ;
2022-01-28 17:35:47 +07:00
mod maybe_send ;
2020-01-20 04:47:36 +01:00
mod runtime ;
2020-01-19 10:17:08 +01:00
2022-01-28 18:24:07 +07:00
pub mod backend ;
2020-01-20 04:47:36 +01:00
pub mod executor ;
2020-01-19 10:17:08 +01:00
pub mod subscription ;
pub use command ::Command ;
2020-01-20 04:47:36 +01:00
pub use executor ::Executor ;
2022-01-28 17:35:47 +07:00
pub use maybe_send ::MaybeSend ;
2021-11-14 11:03:15 -05:00
pub use platform ::* ;
2020-01-19 10:17:08 +01:00
pub use runtime ::Runtime ;
pub use subscription ::Subscription ;
2020-03-26 14:53:58 +01:00
#[ cfg(not(target_arch = " wasm32 " )) ]
2021-11-14 11:03:15 -05:00
mod platform {
/// A boxed static future.
///
/// - On native platforms, it needs a `Send` requirement.
/// - On the Web platform, it does not need a `Send` requirement.
pub type BoxFuture < T > = futures ::future ::BoxFuture < 'static , T > ;
2020-03-26 14:53:58 +01:00
2021-11-14 11:03:15 -05:00
/// A boxed static stream.
///
/// - On native platforms, it needs a `Send` requirement.
/// - On the Web platform, it does not need a `Send` requirement.
pub type BoxStream < T > = futures ::stream ::BoxStream < 'static , T > ;
2020-03-26 14:53:58 +01:00
2021-11-14 11:03:15 -05:00
/// Boxes a stream.
///
/// - On native platforms, it needs a `Send` requirement.
/// - On the Web platform, it does not need a `Send` requirement.
pub fn boxed_stream < T , S > ( stream : S ) -> BoxStream < T >
where
S : futures ::Stream < Item = T > + Send + 'static ,
{
futures ::stream ::StreamExt ::boxed ( stream )
}
}
2020-03-26 14:53:58 +01:00
#[ cfg(target_arch = " wasm32 " ) ]
2021-11-14 11:03:15 -05:00
mod platform {
/// A boxed static future.
///
/// - On native platforms, it needs a `Send` requirement.
/// - On the Web platform, it does not need a `Send` requirement.
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.
pub type BoxStream < T > = futures ::stream ::LocalBoxStream < 'static , T > ;
/// Boxes a stream.
///
/// - On native platforms, it needs a `Send` requirement.
/// - On the Web platform, it does not need a `Send` requirement.
pub fn boxed_stream < T , S > ( stream : S ) -> BoxStream < T >
where
S : futures ::Stream < Item = T > + 'static ,
{
futures ::stream ::StreamExt ::boxed_local ( stream )
}
}