1 //! Tools for working with tasks.
2 
3 #![cfg_attr(feature = "cfg-target-has-atomic", feature(cfg_target_has_atomic))]
4 
5 #![cfg_attr(not(feature = "std"), no_std)]
6 
7 #![warn(missing_docs, missing_debug_implementations, rust_2018_idioms, unreachable_pub)]
8 // It cannot be included in the published code because this lints have false positives in the minimum required version.
9 #![cfg_attr(test, warn(single_use_lifetimes))]
10 #![warn(clippy::all)]
11 #![doc(test(attr(deny(warnings), allow(dead_code, unused_assignments, unused_variables))))]
12 
13 #[cfg(all(feature = "cfg-target-has-atomic", not(feature = "unstable")))]
14 compile_error!("The `cfg-target-has-atomic` feature requires the `unstable` feature as an explicit opt-in to unstable features");
15 
16 #[cfg(feature = "alloc")]
17 extern crate alloc;
18 
19 macro_rules! cfg_target_has_atomic {
20     ($($item:item)*) => {$(
21         #[cfg_attr(feature = "cfg-target-has-atomic", cfg(target_has_atomic = "ptr"))]
22         $item
23     )*};
24 }
25 
26 mod spawn;
27 pub use crate::spawn::{Spawn, SpawnError, LocalSpawn};
28 
29 cfg_target_has_atomic! {
30     #[cfg(feature = "alloc")]
31     mod arc_wake;
32     #[cfg(feature = "alloc")]
33     pub use crate::arc_wake::ArcWake;
34 
35     #[cfg(feature = "alloc")]
36     mod waker;
37     #[cfg(feature = "alloc")]
38     pub use crate::waker::waker;
39 
40     #[cfg(feature = "alloc")]
41     mod waker_ref;
42     #[cfg(feature = "alloc")]
43     pub use crate::waker_ref::{waker_ref, WakerRef};
44 }
45 
46 mod future_obj;
47 pub use crate::future_obj::{FutureObj, LocalFutureObj, UnsafeFutureObj};
48 
49 mod noop_waker;
50 pub use crate::noop_waker::noop_waker;
51 pub use crate::noop_waker::noop_waker_ref;
52 
53 #[doc(no_inline)]
54 pub use core::task::{Context, Poll, Waker, RawWaker, RawWakerVTable};
55