event

#[event]
Expand description

The event attribute allows a struct to be used with emit! so that programs can log significant events in their programs that clients can subscribe to. Currently, this macro is for structs only.

ยงArguments

  • discriminator: Override the default 8-byte discriminator

    Usage: discriminator = <CONST_EXPR>

    All constant expressions are supported.

    Examples:

    • discriminator = 1 (shortcut for [1])
    • discriminator = [1, 2, 3, 4]
    • discriminator = b"hi"
    • discriminator = MY_DISC
    • discriminator = get_disc(...)

See the emit! macro for an example.