Trait Contract

Source
pub trait Contract {
    type Error: From<&'static str>;
    type WithPostInfo<T>;
    type Result<T, E>;

    // Required methods
    fn map_post<I, O>(
        v: Self::WithPostInfo<I>,
        mapper: impl FnOnce(I) -> O,
    ) -> Self::WithPostInfo<O>;
    fn with_default_post<T>(v: T) -> Self::WithPostInfo<T>;
}
Expand description

Contract configuration

Required Associated Types§

Source

type Error: From<&'static str>

Contract error type

Source

type WithPostInfo<T>

Wrapper for Result Ok/Err value

Source

type Result<T, E>

Return value of Callable, expected to be of core::result::Result type

Required Methods§

Source

fn map_post<I, O>( v: Self::WithPostInfo<I>, mapper: impl FnOnce(I) -> O, ) -> Self::WithPostInfo<O>

Map WithPostInfo value

Source

fn with_default_post<T>(v: T) -> Self::WithPostInfo<T>

Wrap value with default post info

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§