OptionOrPanic

Trait OptionOrPanic 

Source
pub trait OptionOrPanic<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 Option or panic with a message.

Results: Some(T) -> T None -> panic with custom message

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> OptionOrPanic<T> for Option<T>

Source§

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

Implementors§