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
//! Single-producer/single-consumer result slot backing one `AsyncHandle`.
//!
//! The async half of the completion path: the executor (the **producer**, which
//! calls `complete` exactly once) hands a task's output to the awaiting
//! `AsyncHandle` future (the **consumer**, which calls `try_take_ready` /
//! `register_waker` from `poll`).
//!
//! This is [`ResultCell`] with `Waker` as the waiter payload, so the state
//! machine, the cell-access invariants and the ordering argument live in
//! `moirai-utils` once and the blocking `TaskResultSlot` in `moirai-core` runs
//! the same code — see [`ResultCell`] for the protocol, including why the
//! consumer's re-check after registering is load-bearing rather than defensive.
//!
//! `Waker` registers with `REPLACE_ON_REPEAT`, which is what this side needs: a
//! re-poll may carry a different waker and the newest must win.
use ResultCell;
use Waker;
/// Single-producer result slot for one async handle.
pub