Trait EventPayload

pub trait EventPayload {
    const ID: u16;
    const SOURCE: Option<&'static str>;
}
Expand description

A trait to identify event payloads in the plugin framework.

Each event has two main identifiers:

  • ID: a unique identifier for the event type, which is a 16-bit unsigned integer.
  • SOURCE: the name of the event source. For plugin events, this is the name of the plugin that generated the event. For syscall events, this is always Some("syscall").

The source can be None if the event can come from multiple sources, such as in the case of async or plugin events coming from different plugins.

Required Associated Constants§

const ID: u16

const SOURCE: Option<&'static str>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a, T> EventPayload for AsyncEvent<'a, T>
where T: EventSource,

Source§

const ID: u16 = 402u16

Source§

const SOURCE: Option<&'static str> = <T as EventSource>::SOURCE

Source§

impl<T> EventPayload for PluginEvent<T>
where T: EventSource,

Source§

const ID: u16 = 322u16

Source§

const SOURCE: Option<&'static str> = <T as EventSource>::SOURCE