[][src]Function quit::with_code

pub fn with_code(exit_code: i32) -> !

Cleanly exits the program with an exit code.

Calling this function from within an FFI boundary invokes undefined behavior. Because panics are used internally to unwind the stack, the exit code cannot be passed safely. process::exit should be used instead in that case.

This function will not behave as expected unless #[main] is attached to the main function. Other implementation notes are mentioned in the module-level documentation.

Examples

This example panics
fn exit() -> ! {
    quit::with_code(1);
}