Trait Handler

Source
pub trait Handler:
    FnMut(ShutdownType)
    + Send
    + 'static { }
Expand description

This trait is implemented for functions which match the required signature for shutdown handlers.

The shutdown request type is passed in as a parameter. The handler will be called on a background thread, so does not need to be async-signal-safe.

On windows, this is simply the way the API is designed to work (windows will automatically spawn a thread to handle the shutdown request).

On other platforms, this crate will spawn a background thread whenever the first ShutdownGuard is created, and will stop it whenever the last ShutdownGuard is destroyed. Shutdown handlers will run on this background thread.

Implementors§

Source§

impl<T: FnMut(ShutdownType) + Send + 'static> Handler for T