1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! Multi-producer, multi-consumer channel.
//!
//! `!Send`, no-atomics; [`bounded`] and [`unbounded`] flavors. Both senders and
//! receivers are `Clone`: every sender clone is another producer, every receiver clone
//! another consumer. A delivered item goes to exactly one awaiting consumer; the
//! channel stays open for sends until the last receiver drops, and stays drainable by
//! receivers until the last sender drops. Each flavor offers a non-blocking `try_*`
//! surface and an awaitable `recv` (and, when bounded, `send`) whose futures are
//! `Unpin` + [`FusedFuture`](futures_core::future::FusedFuture).
pub use ;
pub use ;
pub use Recv;
pub use Send;
use Chan;
/// Creates a bounded channel that holds at most `cap` queued items.
///
/// [`Sender::try_send`] reports [`TrySendError::Full`] when the queue is at capacity.
/// `cap` must be non-zero: a zero-capacity rendezvous cannot be represented on a
/// single thread, where every sender and receiver share it and a hand-off that parked
/// the thread would deadlock.
///
/// # Panics
///
/// Panics if `cap == 0`.
/// Creates an unbounded channel: [`Sender::try_send`] never reports
/// [`TrySendError::Full`], growing the queue a block at a time as needed.