#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

#84 in #return

Download history 16/week @ 2024-04-01

141 downloads per month

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
~35K SLoC