QuitOnError

Trait QuitOnError 

Source
pub trait QuitOnError<T>: Sealed {
    // Required method
    fn quit_on_error(self) -> T;
}
Expand description

Well, if you prefer the word quit to exit.

A trait for quitting processes gracefully.

Required Methods§

Source

fn quit_on_error(self) -> T

Quits the process with an error message if the result is an error or the option is None.

Implementations on Foreign Types§

Source§

impl<T> QuitOnError<T> for Option<T>

Source§

fn quit_on_error(self) -> T

Quits the process with an error message if the option is None.

§Examples
use eoe::QuitOnError;

None::<()>.quit_on_error();
Source§

impl<T, E> QuitOnError<T> for Result<T, E>
where E: Into<Error>,

Source§

fn quit_on_error(self) -> T

Quits the process with an error message if the result is an error.

§Examples
use anyhow::{Context, anyhow};
use eoe::QuitOnError;

Err::<(), _>(anyhow!("Mm-ba-ba-beh, mm-ba-ba-beh"))
    .context("Dee-day-da, ee-day-da")
    .quit_on_error();

Implementors§