pub trait ToSysexitsResultExt<T> {
    // Required method
    fn to_sysexits(self) -> Result<T, Exit>;
}
Expand description

Extension for converting errors to Exit

Example

use proc_exit::prelude::*;

fn main() {
    // Simple but Macro-less `main`
    // - Fast compiles
    // - Composable with other features
    let result = run();
    proc_exit::exit(result);
}

fn run() -> proc_exit::ExitResult {
    // Integrates directly with `std::io::Error`, returning the right exit code.
    let exit_status = std::process::Command::new("true")
         .status().to_sysexits()?;
    // Can pass `Command` exit codes right up, when appropriate
    proc_exit::Code::from_status(exit_status).ok()?;

    proc_exit::Code::SUCCESS.ok()
}

Required Methods§

source

fn to_sysexits(self) -> Result<T, Exit>

Convert an Error into an Exit

Implementations on Foreign Types§

source§

impl<T> ToSysexitsResultExt<T> for Result<T, Error>

Implementors§