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
52
53
54
55
56
//! `Select` helper and top-level channel constructor functions.
use Result;
use ;
use ;
/// Non-blocking poll over multiple receive closures.
///
/// This is a single-pass poll, not a Go-style blocking `select`: each closure
/// is tried once in order and the first successful receive wins; when every
/// closure fails the call returns `None` immediately without waiting or
/// registering wakeups.
;
/// Create a new SPSC channel pair with the given capacity.
/// Create a new bounded MPMC channel with the given capacity.
///
/// This is the constructor to reach for. Callers with no rate information of
/// their own should pass [`DEFAULT_CHANNEL_CAPACITY`].
///
/// [`DEFAULT_CHANNEL_CAPACITY`]: super::config::DEFAULT_CHANNEL_CAPACITY
/// Create a new MPMC channel whose queue grows without limit.
///
/// # Memory
///
/// This channel applies **no backpressure**: a producer that outruns its
/// consumer grows the queue until allocation fails. It is deliberately absent
/// from [`crate::prelude`] and from the crate root so that reaching for it is
/// a decision rather than the path of least resistance — prefer [`mpmc`], and
/// use this only where the total number of sends is bounded by
/// construction (a fixed fan-in, a drained one-shot batch) and blocking a
/// producer would deadlock.