Trait casper_contract::unwrap_or_revert::UnwrapOrRevert [−][src]
pub trait UnwrapOrRevert<T> {
fn unwrap_or_revert(self) -> T;
fn unwrap_or_revert_with<E: Into<ApiError>>(self, error: E) -> T;
}
Expand description
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
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
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.