Skip to main content

Crate sysexits

Crate sysexits 

Source
Expand description

The sysexits crate provides the system exit code constants as defined by <sysexits.h>.

The ExitCode type implements the Termination trait, so this can be returned from the main function.

§Examples

use std::str;

use sysexits::ExitCode;

fn main() -> ExitCode {
    let bytes = [0xF0, 0x9F, 0xA6, 0x80];
    match str::from_utf8(&bytes) {
        Ok(string) => {
            assert_eq!(string, "🦀");
            ExitCode::Ok
        }
        Err(err) => {
            eprintln!("{err}");
            ExitCode::DataErr
        }
    }
}

Modules§

errorstd
Error types for this crate.

Enums§

ExitCode
ExitCode is a type that represents the system exit code constants as defined by <sysexits.h>.

Type Aliases§

Result
A Result type based on ExitCode.