ducaale / exit_status

a proc-macro that allows rust's main function to return an exit status code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

exit_status

Version info

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()?);
// }

About

a proc-macro that allows rust's main function to return an exit status code

License:MIT License


Languages

Language:Rust 100.0%