#status #exit #return #proc-macro

macro exit_status

Simple proc-macro for enabling rust main function to return an exit status code

1 unstable release

0.1.0 Feb 24, 2021

#80 in #exit

MIT license

4KB

exit_status

Simple proc-macro for enabling rust main function to return an exit status code.

Example

#[exit_status::main]
fn main() -> anyhow::Result<i32> {
    Ok(0)
}

// expands to
// fn main() -> anyhow::Result<()> {
//     fn inner_main() -> anyhow::Result<i32> {
//         {
//             Ok(0)
//         }
//     }
//     std::process::exit(inner_main()?);
// }

Dependencies

~1.5MB
~33K SLoC