Type Alias concordium_std::InitResult
source · pub type InitResult<S> = Result<S, Reject>;
Expand description
The expected return type of the init method of the smart contract, parametrized by the state type of the smart contract.
Optionally, to define a custom type for error instead of using Reject, allowing the track the reason for rejection.
See also the documentation for bail! for how to use custom error types.
§Example
Defining a custom error type that implements Reject
and Serial
.
#[derive(Serial, Reject)]
enum MyCustomError {
SomeError,
}
#[init(contract = "mycontract")]
fn contract_init(
_ctx: &InitContext,
_state_builder: &mut StateBuilder,
) -> Result<(), MyCustomError> {
Err(MyCustomError::SomeError)
}
Aliased Type§
enum InitResult<S> {
Ok(S),
Err(Reject),
}