Event

Derive Macro Event 

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

Derives the Event trait for a type.

This macro implements the Event trait for a type, allowing it to participate in the event system. It provides serialization and deserialization capabilities for the type.

§Attributes

  • #[event(tag = "custom_tag")] - Specifies a custom tag for the event type. If not provided, the tag will be generated from the module path and type name.

§Requires

  • The type must implement the Serialize and Deserialize traits from the serde crate.

§Examples

#[derive(Event)]
struct MyEvent {
    field: String,
}