Module fallible

Module fallible 

Source
Expand description

Utilities for graceful channel shutdown handling.

When actors communicate via channels, senders may outlive receivers during shutdown. This module provides extension traits and helpers that handle disconnection gracefully rather than panicking.

§Example

use commonware_utils::channels::fallible::FallibleExt;

// Fire-and-forget: silently ignore disconnection
sender.send_lossy(Message::Shutdown);

// Request-response: return None on disconnection
let result = sender.request(|tx| Message::Query { responder: tx }).await;

Traits§

AsyncFallibleExt
Extension trait for bounded channel operations that may fail due to disconnection.
FallibleExt
Extension trait for channel operations that may fail due to disconnection.
OneshotExt
Extension trait for oneshot sender operations that may fail due to disconnection.