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
//! Task-ownership helpers.
//!
//! A sibling relay task must not outlive its parent future as a detached task.
//! [`spawn_guarded`] wraps a spawned task in an [`AbortOnDrop`] guard, so if the
//! parent is dropped (e.g. its turn is cancelled) before it `take()`s the handle
//! to await it, the task is aborted rather than leaked. The effect runner's
//! streaming relays and the provider stream bridge both own their relay tasks
//! this way, making the "every task is owned" invariant hold structurally rather
//! than only behaviorally (#F39, #58, #60).
/// Await a sibling relay task's handle, logging a panic (but not a normal
/// post-cancellation abort). Awaiting the handle keeps a stray panic from
/// vanishing the way a bare `let _ = handle.await` would.
pub async
/// Owns a sibling relay task so it cannot outlive its parent future as a
/// detached task: if the parent is dropped before it `take()`s the handle for
/// [`join_logged`], the guard aborts the task on drop. On the normal path the
/// handle is taken and awaited, so the drop is a no-op.
>>);
/// `tokio::spawn` a relay, wrapped in an [`AbortOnDrop`] so the parent owns it.