run_with

Function run_with 

Source
pub fn run_with<T, E, F>(
    func: impl FnOnce(CancelSignal) -> F + Send + 'static,
) -> !
where T: Send + 'static, E: Display + Send + 'static, F: Future<Output = Result<T, E>> + Send + 'static,
Expand description

Starts a task from the given function, waits for it to stop, then exits the process.

If the task fails, this function logs the error and exits the process with a non-zero exit code.

The provided function is passed a task::CancelSignal that is triggered when the process receives a termination signal (SIGINT, SIGTERM, or SIGQUIT).