https://github.com/ducaale/exit_status
a proc-macro that allows rust's main function to return an exit status code
https://github.com/ducaale/exit_status
proc-macro rust
Last synced: 8 months ago
JSON representation
a proc-macro that allows rust's main function to return an exit status code
- Host: GitHub
- URL: https://github.com/ducaale/exit_status
- Owner: ducaale
- License: mit
- Created: 2021-02-24T20:43:58.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-02-24T21:35:47.000Z (almost 5 years ago)
- Last Synced: 2025-02-12T05:58:37.709Z (about 1 year ago)
- Topics: proc-macro, rust
- Language: Rust
- Homepage:
- Size: 4.88 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# exit_status
[](https://crates.io/crates/exit_status)
Simple proc-macro for enabling rust main function to return an exit status code.
## Example
```rust
#[exit_status::main]
fn main() -> anyhow::Result {
Ok(0)
}
// expands to
// fn main() -> anyhow::Result<()> {
// fn inner_main() -> anyhow::Result {
// {
// Ok(0)
// }
// }
// std::process::exit(inner_main()?);
// }
```