ink_env::call::utils

Trait Unwrap

Source
pub trait Unwrap {
    type Output;

    // Required method
    fn unwrap_or_else<F>(self, f: F) -> Self::Output
       where F: FnOnce() -> Self::Output;
}
Expand description

Implemented by Set and Unset in order to unwrap their value.

This is useful in case the use-site does not know if it is working with a set or an unset value generically unwrap it using a closure for fallback.

Required Associated Types§

Source

type Output

The output type of the unwrap_or_else operation.

Required Methods§

Source

fn unwrap_or_else<F>(self, f: F) -> Self::Output
where F: FnOnce() -> Self::Output,

Returns the set value or evaluates the given closure.

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> Unwrap for Set<T>

Source§

impl<T> Unwrap for Unset<T>