1#![doc = include_str!("../README.md")]
2#![cfg_attr(not(feature = "std"), no_std)]
3#![cfg_attr(docsrs, feature(doc_cfg))]
5
6#[cfg(feature = "alloc")]
7extern crate alloc;
8
9#[cfg(all(feature = "alloc", not(target_has_atomic = "ptr")))]
11compile_error!(
12 "`Deferred` (the `alloc` feature of async-deferred) needs atomic compare-and-swap, which \
13 this target does not have (for example Cortex-M0 or ESP32-C3). Use `StaticDeferred` \
14 instead: disable `alloc` and enable the `static-deferred` feature."
15);
16
17#[cfg(all(feature = "alloc", target_has_atomic = "ptr"))]
18mod deferred;
19mod embassy;
20mod error;
21mod spawner;
22#[cfg(feature = "static-deferred")]
23mod static_deferred;
24
25#[cfg(feature = "alloc")]
26#[doc(hidden)]
27pub mod __private {
28 pub use alloc::boxed::Box;
29}
30
31#[cfg(all(feature = "alloc", target_has_atomic = "ptr"))]
32#[cfg_attr(docsrs, doc(cfg(feature = "alloc")))]
33pub use deferred::{Deferred, IntoResult};
34pub use error::{BeginError, Error, SpawnError, State};
35#[cfg(feature = "smol")]
36#[cfg_attr(docsrs, doc(cfg(feature = "smol")))]
37pub use spawner::Smol;
38#[cfg(feature = "tokio")]
39#[cfg_attr(docsrs, doc(cfg(feature = "tokio")))]
40pub use spawner::Tokio;
41pub use spawner::{LocalSpawner, Spawner};
42#[cfg(feature = "static-deferred")]
43#[cfg_attr(docsrs, doc(cfg(feature = "static-deferred")))]
44pub use static_deferred::{StaticDeferred, Ticket};