Function ink_lang::utils::initialize_contract
source · [−]pub fn initialize_contract<Contract, F, R>(
initializer: F
) -> <R as InitializerReturnType<Contract>>::Wrapped where
Contract: ContractRootKey + SpreadAllocate,
F: FnOnce(&mut Contract) -> R,
R: InitializerReturnType<Contract>,
Expand description
Initializes the ink! contract using the given initialization routine.
Note
- This uses
SpreadAllocate
trait in order to default initialize the ink! smart contract before calling the initialization routine. - This either returns
Contract
orResult<Contract, E>
depending on the return typeR
of the initializer closureF
. IfR
is()
thenContract
is returned and ifR
is any type ofResult<(), E>
thenResult<Contract, E>
is returned. Other return types forF
than the ones listed above are not allowed.