Trait UnwrapReject

Source
pub trait UnwrapReject<T> {
    // Required methods
    fn unwrap_or_reject(self) -> T;
    fn expect_or_reject(self, msg: &str) -> T;
}
Expand description

Extension trait for Option and Result that panics with a custom message on failure.

Required Methods§

Source

fn unwrap_or_reject(self) -> T

Unwraps the value with a default panic message.

Source

fn expect_or_reject(self, msg: &str) -> T

Unwraps the value with a custom panic message.

Implementations on Foreign Types§

Source§

impl<T> UnwrapReject<T> for Option<T>

Source§

fn unwrap_or_reject(self) -> T

Source§

fn expect_or_reject(self, msg: &str) -> T

Source§

impl<T, E: Display> UnwrapReject<T> for Result<T, E>

Source§

fn unwrap_or_reject(self) -> T

Source§

fn expect_or_reject(self, msg: &str) -> T

Implementors§