Skip to main content

BranchKey

Derive Macro BranchKey 

Source
#[derive(BranchKey)]
{
    // Attributes available to this derive:
    #[branch_key]
}
Available on crate feature macros only.
Expand description

Derives BranchKey for a fieldless enum.

Each variant maps to a snake_case string key by default. Use #[branch_key("custom_key")] on a variant to override.

§Example

use sayiir_macros::BranchKey;

#[derive(BranchKey)]
enum Intent {
    Billing,           // key = "billing"
    TechSupport,       // key = "tech_support"
    #[branch_key("other")]
    Fallback,          // key = "other"
}