/sysexits-rs

The system exit codes as defined by <sysexits.h> for Rust

Primary LanguageRustOtherNOASSERTION

sysexits-rs

CI Version Docs License

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.

Usage

Add this to your Cargo.toml:

[dependencies]
sysexits = "0.7.2"

Example

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
        }
    }
}

Crate features

std

Enables features that depend on the standard library. This is enabled by default.

no_std support

This supports no_std mode. Disables the default feature to enable this.

Documentation

See the documentation for more details.

Minimum supported Rust version

The minimum supported Rust version (MSRV) of this library is v1.61.0.

Changelog

Please see CHANGELOG.adoc.

Contributing

Please see CONTRIBUTING.adoc.

License

Copyright © 2022–2023 Shun Sakai and other contributors (see AUTHORS.adoc)

This library is distributed under the terms of either the Apache License 2.0 or the MIT License.

See COPYING for more details.