Skip to main content

euv_ui/hook/suspense/
struct.rs

1use super::*;
2
3/// A handle that drives a `SuspenseState`.
4///
5/// Created via `SuspenseHandle::new()`. The handle owns
6/// the underlying `Signal<SuspensePhase<T>>` and exposes
7/// `state()` to read it. The handle itself is the only
8/// thing that can mutate the phase, via
9/// `resolve_sync` (every target) or `resolve_async`
10/// (wasm-only).
11#[derive(Clone, Data, Debug)]
12pub struct SuspenseHandle<T: Clone + PartialEq + 'static> {
13    /// The phase signal.
14    pub(crate) phase: Signal<SuspensePhase<T>>,
15}
16
17/// `SuspenseHandle<T>` is `Copy` when `T` is — `Signal<...>` is
18/// `Copy` for any `T: Clone + PartialEq + 'static`, so this
19/// blanket impl is sound.
20impl<T> Copy for SuspenseHandle<T> where T: Clone + PartialEq + 'static {}