pub struct ErrorHandlerNode<S: State> { /* private fields */ }Expand description
Node wrapper that adds error recovery handling
Wraps an inner node and invokes the error handler when the inner node fails, allowing the graph to recover from errors gracefully.
The error handler receives the error and produces a fallback state update. Since the inner node consumes the input state, the handler receives a state snapshot.
Implementations§
Source§impl<S: State> ErrorHandlerNode<S>
impl<S: State> ErrorHandlerNode<S>
Sourcepub fn new(
inner: Arc<dyn Node<S>>,
handler: Arc<dyn Fn(NodeError<S>) -> Command<S> + Send + Sync>,
) -> Self
pub fn new( inner: Arc<dyn Node<S>>, handler: Arc<dyn Fn(NodeError<S>) -> Command<S> + Send + Sync>, ) -> Self
Create a new error handler node
§Arguments
inner- The node to wraphandler- Function invoked wheninnerreturns an error, receivingNodeErrorwith detailed information and producing a fallback command
Trait Implementations§
Source§impl<S: State> Debug for ErrorHandlerNode<S>
impl<S: State> Debug for ErrorHandlerNode<S>
Auto Trait Implementations§
impl<S> !RefUnwindSafe for ErrorHandlerNode<S>
impl<S> !UnwindSafe for ErrorHandlerNode<S>
impl<S> Freeze for ErrorHandlerNode<S>
impl<S> Send for ErrorHandlerNode<S>
impl<S> Sync for ErrorHandlerNode<S>
impl<S> Unpin for ErrorHandlerNode<S>
impl<S> UnsafeUnpin for ErrorHandlerNode<S>
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