pub struct ErrorBoundary { /* private fields */ }Expand description
Catches panics (and future framework-level errors) from a child subtree and renders a fallback element in their place.
§Phase 1 note
In Phase 1 the child is already a resolved Element, so render() simply
returns the child clone. Panic catching around RosaceComponent::build()
calls happens at the framework dispatch level (in rosace-render /
rosace-cli), not here. The ErrorBoundary struct and its API are the
stable surface; the real panic-catching wiring is added in a later phase.
Implementations§
Source§impl ErrorBoundary
impl ErrorBoundary
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates an ErrorBoundary with a default fallback that renders the
error message as a text element.
Sourcepub fn fallback(
self,
f: impl Fn(&RosaceError) -> Element + Send + Sync + 'static,
) -> Self
pub fn fallback( self, f: impl Fn(&RosaceError) -> Element + Send + Sync + 'static, ) -> Self
Replaces the fallback renderer.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ErrorBoundary
impl !UnwindSafe for ErrorBoundary
impl Freeze for ErrorBoundary
impl Send for ErrorBoundary
impl Sync for ErrorBoundary
impl Unpin for ErrorBoundary
impl UnsafeUnpin for ErrorBoundary
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more