macro_rules! quick_main { ($main:expr) => { ... }; }
Expand description
Convenient wrapper to be able to use ?
and such in the main. You can
use it with a separated function:
quick_main!(run);
fn run() -> Result<()> {
Err("error".into())
}
or with a closure:
quick_main!(|| -> Result<()> {
Err("error".into())
});
You can also set the exit value of the process by returning a type that implements ExitCode
:
quick_main!(run);
fn run() -> Result<i32> {
Err("error".into())
}