Trait ResultExt

Source
pub trait ResultExt<T, E>: Sealed {
    // Required method
    fn expect_exit(self, msg: &str, code: i32) -> T;
}
Available on crate feature result only.
Expand description

Result extensions designed to simplify console based tools.

Required Methods§

Source

fn expect_exit(self, msg: &str, code: i32) -> T

Expects a given result to unwrap without issues, in case the result is an error, this function exits the program.

§Arguments
  • msg: a failure context message.
  • code: the exit code to exit the program with in case of error.

returns: T the value if no errors have occurred.

Implementations on Foreign Types§

Source§

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

Source§

fn expect_exit(self, msg: &str, code: i32) -> T

Implementors§