mz_adapter

Trait ResultExt

Source
pub trait ResultExt<T> {
    // Required methods
    fn unwrap_or_terminate(self, context: &str) -> T;
    fn maybe_terminate(self, context: &str) -> Self;
}

Required Methods§

Source

fn unwrap_or_terminate(self, context: &str) -> T

Like Result::expect, but terminates the process with halt or exit code 0 instead of panic if the error indicates that it should cause a halt of graceful termination.

Source

fn maybe_terminate(self, context: &str) -> Self

Terminates the process with halt or exit code 0 if self is an error that should halt or cause graceful termination. Otherwise, does nothing.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T, E> ResultExt<T> for Result<T, E>

Source§

fn unwrap_or_terminate(self, context: &str) -> T

Source§

fn maybe_terminate(self, context: &str) -> Self

Implementors§