Skip to main content

UnwrapOrExit

Trait UnwrapOrExit 

Source
pub trait UnwrapOrExit<T> {
    // Required method
    fn unwrap_or_exit(self) -> T;
}
Expand description

Extension trait for converting Result<GenerateOutput, BuildErrors> into a direct output with process::exit(1) on error.

Provides a drop-in migration path from the old generate_icons() API that called process::exit internally.

§Example

use native_theme_build::UnwrapOrExit;

native_theme_build::generate_icons("icons/icons.toml")
    .unwrap_or_exit()
    .emit_cargo_directives()
    .expect("failed to write generated code");

Required Methods§

Source

fn unwrap_or_exit(self) -> T

Unwrap the Ok value or emit cargo errors and exit the process.

Implementations on Foreign Types§

Source§

impl UnwrapOrExit<GenerateOutput> for Result<GenerateOutput, BuildErrors>

Implementors§