23 unstable releases (6 breaking)

new 0.7.6 Nov 30, 2023
0.7.4 Oct 3, 2023
0.6.1 Jun 22, 2023
0.4.1 Jan 28, 2023
0.3.0 Jun 10, 2022

#52 in Command-line interface

Download history 1197/week @ 2023-08-14 2183/week @ 2023-08-21 1681/week @ 2023-08-28 1760/week @ 2023-09-04 1373/week @ 2023-09-11 2121/week @ 2023-09-18 1764/week @ 2023-09-25 1811/week @ 2023-10-02 1758/week @ 2023-10-09 1629/week @ 2023-10-16 1468/week @ 2023-10-23 1694/week @ 2023-10-30 1543/week @ 2023-11-06 1553/week @ 2023-11-13 1617/week @ 2023-11-20 2108/week @ 2023-11-27

6,980 downloads per month
Used in 11 crates (9 directly)

Apache-2.0 OR MIT

82KB
1.5K SLoC

Rust 1.5K SLoC // 0.0% comments AsciiDoc 182 SLoC // 0.1% comments

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.6"

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.

nightly

Enables features that depend on the nightly Rust.

extended_io_error

Enables features that depend on the io_error_more feature. This also enables std. This is implied by nightly.

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.

This project is compliant with version 3.0 of the REUSE Specification. See copyright notices of individual files for more details on copyright and licensing information.

No runtime deps

Features