[][src]Trait casperlabs_contract::unwrap_or_revert::UnwrapOrRevert

pub trait UnwrapOrRevert<T> {
    fn unwrap_or_revert(self) -> T;
fn unwrap_or_revert_with<E: Into<ApiError>>(self, error: E) -> T; }

A trait which provides syntactic sugar for unwrapping a type or calling runtime::revert if this fails. It is implemented for Result and Option.

Required methods

fn unwrap_or_revert(self) -> T

Unwraps the value into its inner type or calls runtime::revert with a predetermined error code on failure.

fn unwrap_or_revert_with<E: Into<ApiError>>(self, error: E) -> T

Unwraps the value into its inner type or calls runtime::revert with the provided error on failure.

Loading content...

Implementations on Foreign Types

impl<T, E: Into<ApiError>> UnwrapOrRevert<T> for Result<T, E>[src]

impl<T> UnwrapOrRevert<T> for Option<T>[src]

Loading content...

Implementors

Loading content...