1 | //! Asynchronous channels. |
2 | //! |
3 | //! Like threads, concurrent tasks sometimes need to communicate with each |
4 | //! other. This module contains two basic abstractions for doing so: |
5 | //! |
6 | //! - [oneshot], a way of sending a single value from one task to another. |
7 | //! - [mpsc], a multi-producer, single-consumer channel for sending values |
8 | //! between tasks, analogous to the similarly-named structure in the standard |
9 | //! library. |
10 | //! |
11 | //! All items are only available when the `std` or `alloc` feature of this |
12 | //! library is activated, and it is activated by default. |
13 | |
14 | #![cfg_attr (not(feature = "std" ), no_std)] |
15 | #![warn ( |
16 | missing_debug_implementations, |
17 | missing_docs, |
18 | rust_2018_idioms, |
19 | single_use_lifetimes, |
20 | unreachable_pub |
21 | )] |
22 | #![doc (test( |
23 | no_crate_inject, |
24 | attr( |
25 | deny(warnings, rust_2018_idioms, single_use_lifetimes), |
26 | allow(dead_code, unused_assignments, unused_variables) |
27 | ) |
28 | ))] |
29 | |
30 | #[cfg (not(futures_no_atomic_cas))] |
31 | #[cfg (feature = "alloc" )] |
32 | extern crate alloc; |
33 | |
34 | #[cfg (not(futures_no_atomic_cas))] |
35 | #[cfg (feature = "alloc" )] |
36 | mod lock; |
37 | #[cfg (not(futures_no_atomic_cas))] |
38 | #[cfg (feature = "std" )] |
39 | pub mod mpsc; |
40 | #[cfg (not(futures_no_atomic_cas))] |
41 | #[cfg (feature = "alloc" )] |
42 | pub mod oneshot; |
43 | |