simpleonshutdown

This crate consists of a convenient macro to specify on shutdown callbacks called on_shutdown!. It takes code that should be executed when your program exits (gracefully). See https://docs.rs/simpleonshutdown for more info.

Useful with "runtimes you do not have control over", like for example actix-web framework doesn't let you specify shutdown callbacks by yourself. In such cases my macro may be a better option.

Usage

Recommended

```rust use simpleonshutdown::on_shutdown;

fn main() { // macro can take: direct expression onshutdown!(println!("shut down with success")); // closure expression onshutdown!(|| println!("shut down with success")); // move closure expression onshutdown!(move || println!("shut down with success")); // block onshutdown!({ println!("shut down with success") }); // identifier let identifier = || println!("shut down with success"); on_shutdown!(identifier); }

```

Examples

See "examples/"-dir in repository!.

⚠ Restrictions ⚠