#exit #status #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

#73 in #return

Download history 7/week @ 2024-09-20 1/week @ 2024-09-27

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