match_enum_group

Macro match_enum_group 

Source
match_enum_group!() { /* proc-macro */ }
Expand description

Matches on a grouped enum using ergonomic syntax.

This macro allows you to match on the group level without manually calling into_group() or importing the Group enum.

§Example

use enum_group_macros::match_enum_group;

match_enum_group!(msg, BrokerToCosignerMessage, {
    SupportMessage(s) => {
        // s is SupportMessage enum
        match s {
            SupportMessage::ReportResponse(r) => { /* ... */ }
            SupportMessage::HeartbeatResponse(r) => { /* ... */ }
        }
    },
    BusinessMessage(b) => handle_business(b),
})