Jason Macnak | 09c3688 | 2020-04-01 16:22:56 +0000 | [diff] [blame] | 1 | //! Asynchronous channels. |
| 2 | //! |
Haibo Huang | 09da603 | 2021-02-09 17:02:02 -0800 | [diff] [blame] | 3 | //! Like threads, concurrent tasks sometimes need to communicate with each |
| 4 | //! other. This module contains two basic abstractions for doing so: |
Jason Macnak | 09c3688 | 2020-04-01 16:22:56 +0000 | [diff] [blame] | 5 | //! |
Haibo Huang | 09da603 | 2021-02-09 17:02:02 -0800 | [diff] [blame] | 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 |
Jason Macnak | 09c3688 | 2020-04-01 16:22:56 +0000 | [diff] [blame] | 12 | //! library is activated, and it is activated by default. |
| 13 | |
Jason Macnak | 09c3688 | 2020-04-01 16:22:56 +0000 | [diff] [blame] | 14 | #![cfg_attr(not(feature = "std"), no_std)] |
Joel Galenson | e869538 | 2021-08-09 10:29:26 -0700 | [diff] [blame] | 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 | ))] |
Jason Macnak | 09c3688 | 2020-04-01 16:22:56 +0000 | [diff] [blame] | 29 | |
Joel Galenson | e869538 | 2021-08-09 10:29:26 -0700 | [diff] [blame] | 30 | #[cfg(not(futures_no_atomic_cas))] |
| 31 | #[cfg(feature = "alloc")] |
| 32 | extern crate alloc; |
Jason Macnak | 09c3688 | 2020-04-01 16:22:56 +0000 | [diff] [blame] | 33 | |
Joel Galenson | e869538 | 2021-08-09 10:29:26 -0700 | [diff] [blame] | 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; |