[][src]Struct simple_on_shutdown::ShutdownCallbackDummy

pub struct ShutdownCallbackDummy(_);

Simple type that holds an closure (callback). The closure gets invoked during drop(). This works also fine with applications that do gracefully shutdown via signals, like SIGTERM.

Create this type via on_shutdown!(println!("foobar")) or on_shutdown!({e1; e2; e3; println!("foobar")}). See on_shutdown for more info.

IMPORTANT: Use this on the top level of your main() or whatever your current runtimes main function is! The code gets executed when the context it lives in gets dropped. This can be called multiple times (at least with stable Rust 1.48.0) without problem.

Implementations

impl ShutdownCallbackDummy[src]

pub fn new(inner: Box<dyn FnMut()>) -> Self[src]

Constructor. Better use macro on_shutdown.

Trait Implementations

impl Drop for ShutdownCallbackDummy[src]

pub fn drop(&mut self)[src]

Executes the specified callback.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.