Derive Macro EventValue

Source
#[derive(EventValue)]
{
    // Attributes available to this derive:
    #[event_id]
}
Expand description

Derive macro for the AsEventValue trait

This macro implements AsEventValue for structs and enums, using either the type name as the event_id or by passing a custom event_id.

ยงExample


#[derive(EventValue)]
struct MyEvent {
    data: String,
}

// impl AsEventValue for MyEvent {
//     fn event_id() -> &'static str {
//         "MyEvent"
//     }
// }

#[derive(EventValue)]
#[event_id("custom_event_name")]
struct MyEvent2 {
    data: String,
}

// impl AsEventValue for MyEvent2 {
//     fn event_id() -> &'static str {
//         "custom_event_name"
//     }
// }