logo
event_enum!() { /* proc-macro */ }
Expand description

Generates an enum to represent the various Matrix event types.

This macro also implements the necessary traits for the type to serialize and deserialize itself.

Examples

use ruma_macros::event_enum;

event_enum! {
    enum ToDevice {
        "m.any.event",
        "m.other.event",
    }

    enum State {
        "m.more.events",
        "m.different.event",
    }
}

(The enum name has to be a valid identifier for <EventKind as Parse>::parse)