Derive Macro sp_runtime_interface::pass_by::PassByEnum

source ·
#[derive(PassByEnum)]
Expand description

Derive macro for implementing PassBy with the Enum strategy.

Besides implementing PassBy, this derive also implements TryFrom<u8> and From<Self> for u8 for the type.

The type is required to be an enum with only unit variants and at maximum 256 variants. Also it is required that the type implements Copy.

§Example

#[derive(PassByEnum, Copy, Clone)]
enum Data {
    Okay,
    NotOkay,
    // This will not work with the derive.
    //Why(u32),
}