Type Alias concordium_std::ReceiveResult

source ·
pub type ReceiveResult<A> = Result<A, Reject>;
Expand description

The expected return type of the receive method of a smart contract.

Optionally, to define a custom type for error instead of using Reject, allowing to 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,
}

#[receive(contract = "mycontract", name = "receive")]
fn contract_receive(_ctx: &ReceiveContext, _host: &Host<()>) -> Result<(), MyCustomError> {
    Err(MyCustomError::SomeError)
}

Aliased Type§

enum ReceiveResult<A> {
    Ok(A),
    Err(Reject),
}

Variants§

§1.0.0

Ok(A)

Contains the success value

§1.0.0

Err(Reject)

Contains the error value