Macro error_chain::quick_main [] [src]

macro_rules! quick_main {
    ($main:expr) => { ... };
}

Convenient wrapper to be able to use try! 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())
}