pub trait ConstructorOutput<C>: Sealed {
    type Error;

    const IS_RESULT: bool = false;

    // Required method
    fn as_result(&self) -> Result<&C, &Self::Error>;
}
Expand description

Guards against using invalid contract initializer types.

Note

Currently the only allowed types are () and Result<(), E> where E is some unspecified error type. If the contract initializer returns Result::Err the utility method that is used to initialize an ink! smart contract will revert the state of the contract instantiation.

Required Associated Types§

source

type Error

The error type of the constructor return type.

Note

For infallible constructors this is () whereas for fallible constructors this is the actual return error type. Since we only ever return a value in case of Result::Err the Result::Ok value type does not matter.

Provided Associated Constants§

source

const IS_RESULT: bool = false

Is true if Self is Result<C, E>.

Required Methods§

source

fn as_result(&self) -> Result<&C, &Self::Error>

Converts the return value into a Result instance.

Note

For infallible constructor returns this always yields Ok.

Implementors§