sysexits-rs (sysexits
) is a library that provides the
system exit code constants as defined by <sysexits.h>
.
This library implements the Termination
trait, so
this can be returned from the main
function.
Add this to your Cargo.toml
:
toml
[dependencies]
sysexits = "0.3.0"
```rust fn main() -> sysexits::ExitCode { let bytes = [0xf0, 0x9f, 0x92, 0x96];
match std::str::from_utf8(&bytes) {
Ok(string) => {
println!("{string}");
sysexits::ExitCode::Ok
}
Err(err) => {
eprintln!("{err}");
sysexits::ExitCode::DataErr
}
}
} ```
See the documentation for more details.
The minimum supported Rust version (MSRV) of this library is v1.61.0 or later.
Please see CHANGELOG.adoc.
Please see CONTRIBUTING.adoc.
Copyright (C) 2022 Shun Sakai and Contributors (see AUTHORS.adoc)
This library is distributed under the terms of either the Apache License 2.0 or the MIT License.
See COPYRIGHT, LICENSE-APACHE and LICENSE-MIT for more details.