ctrl_c_cancel

Function ctrl_c_cancel 

Source
pub fn ctrl_c_cancel() -> CancellationToken
Expand description

Create a cancel token that will trigger when Ctrl-C (SIGINT on Unix) is pressed.

If the token is cancelled manually, Ctrl-C’s behavior will return to exiting the process. It is advised to not call this function in a loop because it creates a Tokio task that only exits after Ctrl-C is pressed twice.