ResultOrPanic

Trait ResultOrPanic 

Source
pub trait ResultOrPanic<T> {
    // Required method
    fn or_panic<M: Display>(self, msg: M) -> T;
}

Required Methods§

Source

fn or_panic<M: Display>(self, msg: M) -> T

Unwrap the Result or panic with a message.

Results: Ok(T) -> T Err(E) -> panic with custom message

NOTE: The error type of your Result must implement Debug.

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: Debug> ResultOrPanic<T> for Result<T, E>

Source§

fn or_panic<M: Display>(self, msg: M) -> T

Implementors§