euv_ui/hook/error_boundary/struct.rs
1use super::*;
2
3/// A handle that tracks whether a wrapped subtree has
4/// thrown.
5///
6/// The boundary's phase is exposed via `phase()` as a
7/// `Signal<ErrorBoundaryPhase>`. The parent component
8/// reads that signal to decide whether to render the
9/// child or a fallback.
10///
11/// `try_with(closure)` runs the closure and, if it
12/// panics, transitions the boundary to `Caught`. The
13/// closure's return value (if it didn't panic) is
14/// returned to the caller; if it panicked, an `Err`
15/// is returned containing the panic message.
16#[derive(Clone, Data, Debug)]
17pub struct ErrorBoundary {
18 /// The phase signal.
19 pub(crate) phase: Signal<ErrorBoundaryPhase>,
20}
21
22/// `ErrorBoundary` is `Copy` because `Signal<ErrorBoundaryPhase>`
23/// is itself `Copy` — the signal registry hands out cheap
24/// `usize` addresses.
25impl Copy for ErrorBoundary {}