#exit-code #sysexit

no-std sysexits

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

29 releases

0.7.13 Apr 16, 2024
0.7.11 Jan 18, 2024
0.7.7 Dec 7, 2023
0.7.6 Nov 30, 2023
0.3.0 Jun 10, 2022

#48 in Operating systems

Download history 1747/week @ 2024-01-03 2363/week @ 2024-01-10 2193/week @ 2024-01-17 3357/week @ 2024-01-24 6687/week @ 2024-01-31 6458/week @ 2024-02-07 8301/week @ 2024-02-14 10193/week @ 2024-02-21 10355/week @ 2024-02-28 12288/week @ 2024-03-06 10367/week @ 2024-03-13 10335/week @ 2024-03-20 9655/week @ 2024-03-27 9123/week @ 2024-04-03 11852/week @ 2024-04-10 9747/week @ 2024-04-17

42,934 downloads per month
Used in 13 crates (11 directly)

Apache-2.0 OR MIT

73KB
1.5K SLoC

sysexits-rs

CI Version MSRV 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.13"

Example

use std::str;

use sysexits::ExitCode;

fn main() -> ExitCode {
    let bytes = [0xf0, 0x9f, 0x92, 0x96];
    match str::from_utf8(&bytes) {
        Ok(string) => {
            println!("{string}");
            ExitCode::Ok
        }
        Err(err) => {
            eprintln!("{err}");
            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–2024 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