Crate fateful[−][src]
Expand description
A tool to fatefully exit the process without panics
(Pseudo-)Example:
ⓘ
use std::env;
use rand;
use fateful::fatal;
fn main() {
let args: Vec<String> = env::args().collect();
if args.len() < 3 {
fatal!("missing random items to choose of");
}
let random_items: &Vec<String> = &args[1..args.len()].to_vec();
let index = (rand::random::<f32>() * random_items.len() as f32).floor() as usize;
println!("Random: {} 🎉", random_items[index]);
}
Macros
Returns a prefix of Error:
Throws a fatal error to the standard error output Then exits with an exit code 1