pub struct ErrorBoundary<W> { /* private fields */ }Expand description
A widget wrapper that catches panics from an inner widget.
When the inner widget panics during rendering, the error boundary captures the panic and renders a fallback error indicator instead.
Uses StatefulWidget so the error state persists across renders.
§Example
ⓘ
let boundary = ErrorBoundary::new(my_widget, "my_widget");
let mut state = ErrorBoundaryState::default();
boundary.render(area, &mut buf, &mut state);Implementations§
Source§impl<W: Widget> ErrorBoundary<W>
impl<W: Widget> ErrorBoundary<W>
Sourcepub fn new(inner: W, widget_name: &'static str) -> Self
pub fn new(inner: W, widget_name: &'static str) -> Self
Create a new error boundary wrapping the given widget.
Sourcepub fn max_recovery_attempts(self, max: u32) -> Self
pub fn max_recovery_attempts(self, max: u32) -> Self
Set maximum recovery attempts before permanent fallback.
Sourcepub fn widget_name(&self) -> &'static str
pub fn widget_name(&self) -> &'static str
Get the widget name.
Trait Implementations§
Source§impl<W: Clone> Clone for ErrorBoundary<W>
impl<W: Clone> Clone for ErrorBoundary<W>
Source§fn clone(&self) -> ErrorBoundary<W>
fn clone(&self) -> ErrorBoundary<W>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<W: Debug> Debug for ErrorBoundary<W>
impl<W: Debug> Debug for ErrorBoundary<W>
Source§impl<W: Widget> StatefulWidget for ErrorBoundary<W>
impl<W: Widget> StatefulWidget for ErrorBoundary<W>
Auto Trait Implementations§
impl<W> Freeze for ErrorBoundary<W>where
W: Freeze,
impl<W> RefUnwindSafe for ErrorBoundary<W>where
W: RefUnwindSafe,
impl<W> Send for ErrorBoundary<W>where
W: Send,
impl<W> Sync for ErrorBoundary<W>where
W: Sync,
impl<W> Unpin for ErrorBoundary<W>where
W: Unpin,
impl<W> UnwindSafe for ErrorBoundary<W>where
W: UnwindSafe,
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