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
) ]
2023-05-11 17:28:51 +02:00
#![ cfg_attr(docsrs, feature(doc_auto_cfg)) ]
2020-01-20 04:47:36 +01:00
pub use futures ;
2023-03-05 04:15:10 +01:00
pub use iced_core as core ;
2020-01-20 04:47:36 +01:00
2024-01-18 09:55:27 +01:00
mod maybe ;
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 ;
2023-09-07 02:45:15 +02:00
pub mod event ;
2020-01-20 04:47:36 +01:00
pub mod executor ;
2023-09-07 02:45:15 +02:00
pub mod keyboard ;
2024-07-05 02:15:13 +02:00
pub mod stream ;
2020-01-19 10:17:08 +01:00
pub mod subscription ;
2020-01-20 04:47:36 +01:00
pub use executor ::Executor ;
2024-01-18 09:55:27 +01:00
pub use maybe ::{ MaybeSend , MaybeSync } ;
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 )
}
}