Event

Derive Macro Event 

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

Derive the Event trait. This will also generate an implementation of the EventField trait.

The event struct must have an attribute opcua containing the identifier of the node ID, as well as the namespace URI of the event type.

It must also have a field base with a different event type, which may be the BaseEventType, and a field own_namespace_index storing the namespace index of the event.

By default, fields will be given PascalCase names, you may use opcua[rename = ...] to rename individual fields.

§Example

#[derive(Event)]
#[opcua(identifier = "s=myevent", namespace = "uri:my:namespace")]
struct MyEvent {
    base: BaseEventType,
    own_namespace_index: u16,
     
    #[opcua(rename = "my-field")]
    my_field: f32,
    my_other_field: EUInformation,
    #[opcua(ignore)]
    ignored: i32,
}