pub struct ErrorBoundary { /* private fields */ }Expand description
A handle that tracks whether a wrapped subtree has thrown.
The boundary’s phase is exposed via phase() as a
Signal<ErrorBoundaryPhase>. The parent component
reads that signal to decide whether to render the
child or a fallback.
try_with(closure) runs the closure and, if it
panics, transitions the boundary to Caught. The
closure’s return value (if it didn’t panic) is
returned to the caller; if it panicked, an Err
is returned containing the panic message.
Implementations§
Source§impl ErrorBoundary
Inherent implementation of ErrorBoundary.
impl ErrorBoundary
Inherent implementation of ErrorBoundary.
Sourcepub fn try_with<F, R>(&self, closure: F) -> Result<R, String>where
F: FnOnce() -> R + UnwindSafe,
pub fn try_with<F, R>(&self, closure: F) -> Result<R, String>where
F: FnOnce() -> R + UnwindSafe,
Runs a closure and, if it panics, transitions
the boundary to Caught and returns Err.
On success, the closure’s return value is
returned wrapped in Ok. The closure is
wrapped in AssertUnwindSafe so it does not
have to satisfy UnwindSafe.
§Arguments
F: FnOnce() -> R + UnwindSafe- A generic type parameter.
§Returns
Result<R, String>- Result of the operation; anErrvariant on failure.
Source§impl ErrorBoundary
impl ErrorBoundary
pub fn get_phase(&self) -> &Signal<ErrorBoundaryPhase>
pub fn get_mut_phase(&mut self) -> &mut Signal<ErrorBoundaryPhase>
pub fn set_phase(&mut self, val: Signal<ErrorBoundaryPhase>) -> &mut Self
Trait Implementations§
Source§impl Clone for ErrorBoundary
impl Clone for ErrorBoundary
Source§fn clone(&self) -> ErrorBoundary
fn clone(&self) -> ErrorBoundary
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ErrorBoundary
impl Debug for ErrorBoundary
Source§impl Default for ErrorBoundary
Default-construction for ErrorBoundary.
impl Default for ErrorBoundary
Default-construction for ErrorBoundary.
Source§fn default() -> Self
fn default() -> Self
Constructs a default ErrorBoundary value.
Source§impl Display for ErrorBoundary
Formatting / debug-printing for ErrorBoundary.
impl Display for ErrorBoundary
Formatting / debug-printing for ErrorBoundary.