pub fn safe_run_with_state<F: Fn() -> Result<(), Box<dyn Error>>>(closure: F, error_state: State) {
    if let Err(e) = closure() {
        println!("CRITICAL: {}", e.to_string());
        exit(error_state.exit_code());
    }
}
/// Runs the given closure and exits with the given State after printing out
/// the error message if the Result contains an Err.
Runs the given closure and exits with the given State after printing out
the error message if the Result contains an Err.
Runs the given closure and exits with the given State after printing out the error message if the Result contains an Err .
pub fn safe_run_with_state<F: Fn() -> Result<(), Box<dyn Error>>>(closure: F, error_state: State) {
    if let Err(e) = closure() {
        println!("CRITICAL: {}", e.to_string());
        exit(error_state.exit_code());
    }
}
pub fn safe_run_with_state < F : Fn ( ) -> Result < ( ) , Box < dyn Error > > > ( closure : F , error_state : State ) { if let Err ( e ) = closure ( ) { println ! ( " " e to_string ( ) ) ; exit ( error_state . exit_code ( ) ) ; } }
Runs the given closure and exits with the given State after printing out
the error message if the Result contains an Err.
Runs the given closure and exits with the given State after printing out the error message if the Result contains an Err .
closure
F
error_state
State
closure
F
error_state
State