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_attr(target_os = "none", cfg(target_has_atomic = "ptr"))]
31#[cfg(feature = "alloc")]
32extern crate alloc;
33
34#[cfg_attr(target_os = "none", cfg(target_has_atomic = "ptr"))]
35#[cfg(feature = "alloc")]
36mod lock;
37#[cfg_attr(target_os = "none", cfg(target_has_atomic = "ptr"))]
38#[cfg(feature = "std")]
39pub mod mpsc;
40#[cfg_attr(target_os = "none", cfg(target_has_atomic = "ptr"))]
41#[cfg(feature = "alloc")]
42pub mod oneshot;
43