INNER CODE UNIT · Rust
shutdown
rustic-rs/rustic · src/application.rs:119
fn shutdown(&self, shutdown: Shutdown) -> ! {
let exit_code = match shutdown {
Shutdown::Crash => 1,
_ => 0,
};
self.shutdown_with_exitcode(shutdown, exit_code)
}
/// Shut down this application gracefully, exiting with given exit code.
fn shutdown_with_exitcode(&self, shutdown: Shutdown, exit_code: i32) -> ! {
let hooks = &RUSTIC_APP.config().global.hooks;
match shutdown {
Shutdown::Crash => _ = hooks.run_failed(),
_ => _ = hooks.run_after(),
};
_ = hooks.run_finally();
let result = self.state().components().shutdown(self, shutdown);
if let Err(e) = result {