backend-kit 0.0.3

Provides a set of tools and helpers for building backend services in Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use signal_hook::{
    consts::{SIGINT, SIGTERM},
    iterator::Signals,
};

pub async fn wait_for_signal() {
    let mut signals = Signals::new([SIGINT, SIGTERM]).unwrap();

    if signals.forever().next().is_some() {
        log::info!("received signal, shutting down");
    }
}