Skip to main content

UnwrapOrTrap

Trait UnwrapOrTrap 

Source
pub trait UnwrapOrTrap<T> {
    // Required method
    fn unwrap_or_trap(self) -> T;
}
Expand description

Unwraps a Result<T, String> or traps with the error message.

Required Methods§

Source

fn unwrap_or_trap(self) -> T

Returns the contained Ok(T) value, or traps with the contained error message.

§Panics

Traps the canister execution with the error string.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

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

Source§

impl<T> UnwrapOrTrap<T> for Option<T>

Implementors§