pub trait SystemSignals: Send + Sync {
// Required method
fn wait_for_signal(
&self,
on_shutdown: ShutdownCallback,
) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>;
}Expand description
System signal handling trait
Abstracts platform-specific signal handling for graceful shutdown.
Required Methods§
Sourcefn wait_for_signal(
&self,
on_shutdown: ShutdownCallback,
) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>
fn wait_for_signal( &self, on_shutdown: ShutdownCallback, ) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>
Wait for a shutdown signal and invoke the callback
This method blocks until one of the shutdown signals is received:
- SIGTERM
- SIGINT
- SIGHUP (Unix only)
When a signal is received, the provided callback is invoked to initiate graceful shutdown.
Implementors§
impl SystemSignals for NoOpSignalHandler
impl SystemSignals for UnixSignalHandler
Available on Unix only.