Skip to main content

MastForestContributor

Derive Macro MastForestContributor 

Source
#[derive(MastForestContributor)]
Expand description

Derive trait implementations for enums that dispatch to variant trait implementations.

This macro generates trait implementations that forward method calls to the corresponding variant’s trait implementation, similar to the enum_dispatch crate but without the external dependency.

§Example

use miden_utils_core_derive::MastForestContributor;

#[utils_core_derive(MyTrait)]
#[derive(MastForestContributor)]
pub enum MyEnum {
    Variant1(Type1),
    Variant2(Type2),
}