Trait SignalConfig

Source
pub trait SignalConfig: Global {
    // Provided methods
    fn signals(&self) -> Vec<SignalKind> { ... }
    fn timeout(&self) -> Option<Duration> { ... }
    fn on_shutdown(self: &Arc<Self>) -> impl Future<Output = Result<()>> + Send { ... }
    fn on_force_shutdown(
        &self,
        signal: Option<SignalKind>,
    ) -> impl Future<Output = Result<()>> + Send { ... }
    fn block_global_shutdown(&self) -> impl Future<Output = ()> + Send { ... }
}
Available on crate feature bootstrap only.
Expand description

Configuration for the signal service.

Provided Methods§

Source

fn signals(&self) -> Vec<SignalKind>

The signals to listen for.

By default, listens for SIGTERM and SIGINT.

Source

fn timeout(&self) -> Option<Duration>

The timeout before forcing a shutdown.

Source

fn on_shutdown(self: &Arc<Self>) -> impl Future<Output = Result<()>> + Send

Called when the service is shutting down.

Source

fn on_force_shutdown( &self, signal: Option<SignalKind>, ) -> impl Future<Output = Result<()>> + Send

Called when the service is force shutting down.

Source

fn block_global_shutdown(&self) -> impl Future<Output = ()> + Send

Waits for the global shutdown to complete after a signal cancels the local context. Defaults to the global context’s shutdown ([scuffle_context::Handler::global().shutdown()]). Override to use a custom context or condition for shutdown completion.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§