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
57
58
59
60
use *;
/// `use_async`'s reactive handle, stored in the hook context slot and
/// returned to the user on each render.
///
/// The handle exposes three fields:
///
/// - `state`: the current `AsyncState<T, L>` (matches what the user
/// should `match` on in `html!`).
/// - `refetch`: triggers the future to run again, regardless of
/// whether the previous attempt completed or is still in flight.
/// - `cancel`: drops the in-flight future (if any) and prevents its
/// `Ok`/`Err` branches from mutating the state. Subsequent renders
/// will still call the future again on the next mount.
///
/// Cloning a handle is cheap — `UseAsyncHandle` is `Copy` if its
/// generic parameters are. Use it from event handlers the same way
/// you'd use a `Signal<T>`.
/// Blanket `Copy` for any generic instance — both fields are
/// themselves `Copy` (`usize`, `PhantomData<fn pointer>`).
/// The `where` clause must be repeated because a separate impl
/// block cannot inherit bounds from the type declaration.
/// Heap-allocated state backing a [`super::UseAsyncHandle`].
///
/// Reachable only through the raw address stored in the handle.
/// Allocated by [`super::UseAsyncHandle::new_for_fallback`] for the
/// "no hook context" case and by [`HookContext::use_async`] when
/// the hook is registered for the first time.
pub