by archie2 · 6y ago · 0 comments
If your code is stateful the typestate pattern is particularly easy to write in Rust - http://cliffle.com/blog/rust-typestate/
https://web.archive.org/web/20190401042439/http://blog.mbrt....
Here's what the main function looks like:
fn main() {
match Args::parse().and_then(run) {
Ok(count) if count == 0 => process::exit(1),
Ok(_) => process::exit(0),
Err(err) => {
eprintln!("{}", err);
process::exit(1);
}
}
}