[−][src]Macro die::die
Prints a message to stderr and terminates the current process with the specified exit code or 1 if no exit code is specified, by calling eprintln!() on all arguments followed by process::exit(exit_code)
Examples
Basic usage:
use die::die; die!("argument to -e must be numeric"); // prints message to stderr then exits with code 1
With custom error code:
use die::die; die!(2; "argument to -e must be numeric"); // prints message to stderr then exits with code 2
error code can go at the beginning or end, just separate with colon:
use die::die; die!("argument to -e must be numeric"; 3); // prints message to stderr then exits with code 3
supports all the formatting eprintln! does:
use die::die; die!("argument {} must be {}", "-e", 1; 4); // prints `argument -e must be 1` to stderr then exits with code 4
supports all the formatting eprintln! does without exit code too:
use die::die; die!("argument {} must be {}", "-e", 1); // prints `argument -e must be 1` to stderr then exits with code 1
just exit with a code alone:
use die::die; die!(2); // prints nothing, only exits with code 3
just exit:
use die::die; die!(); // prints nothing, only exits with code 1