blob: 4cd936d552c0e8a7e62071bc6567b4c234d15984 [file] [log] [blame]
Jason Macnak09c36882020-04-01 16:22:56 +00001//! Asynchronous channels.
2//!
Haibo Huang09da6032021-02-09 17:02:02 -08003//! Like threads, concurrent tasks sometimes need to communicate with each
4//! other. This module contains two basic abstractions for doing so:
Jason Macnak09c36882020-04-01 16:22:56 +00005//!
Haibo Huang09da6032021-02-09 17:02:02 -08006//! - [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 Macnak09c36882020-04-01 16:22:56 +000012//! library is activated, and it is activated by default.
13
Jason Macnak09c36882020-04-01 16:22:56 +000014#![cfg_attr(not(feature = "std"), no_std)]
Joel Galensone8695382021-08-09 10:29:26 -070015#![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 Macnak09c36882020-04-01 16:22:56 +000029
Joel Galensone8695382021-08-09 10:29:26 -070030#[cfg(not(futures_no_atomic_cas))]
31#[cfg(feature = "alloc")]
32extern crate alloc;
Jason Macnak09c36882020-04-01 16:22:56 +000033
Joel Galensone8695382021-08-09 10:29:26 -070034#[cfg(not(futures_no_atomic_cas))]
35#[cfg(feature = "alloc")]
36mod lock;
37#[cfg(not(futures_no_atomic_cas))]
38#[cfg(feature = "std")]
39pub mod mpsc;
40#[cfg(not(futures_no_atomic_cas))]
41#[cfg(feature = "alloc")]
42pub mod oneshot;