[−][src]Function af_lib::run_with
pub fn run_with<T, E, F>(
func: impl Send + FnOnce(CancelSignal) -> F + 'static
) -> ! where
E: Display + Send + 'static,
T: Send + 'static,
F: Future<Output = Result<T, E>> + Send + 'static,
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).