UnwrapThrowExt

Trait UnwrapThrowExt 

Source
pub trait UnwrapThrowExt<T>: Sized {
    // Required methods
    fn unwrap_throw(self) -> T;
    fn expect_throw(self, message: &str) -> T;
}
Expand description

Extension trait for Option to unwrap or throw a JS error. This is API-compatible with wasm-bindgen’s UnwrapThrowExt.

Required Methods§

Source

fn unwrap_throw(self) -> T

Unwrap the value or panic with a message.

Source

fn expect_throw(self, message: &str) -> T

Unwrap the value or panic with a 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.

Implementors§

Source§

impl<T> UnwrapThrowExt<T> for Option<T>

Source§

impl<T, E> UnwrapThrowExt<T> for Result<T, E>
where E: Debug,