Trait AnyEventPayload

pub trait AnyEventPayload {
    const SOURCES: &'static [Option<&'static str>];
    const EVENT_TYPES: &'static [u16];

    // Provided method
    fn event_sources() -> Vec<&'static str> { ... }
}
Expand description

A trait to identify a group of event payloads, each having a unique identifier and source.

Required Associated Constants§

const SOURCES: &'static [Option<&'static str>]

The sources of the events that this payload type can represent.

const EVENT_TYPES: &'static [u16]

The event types that this payload type can represent.

Provided Methods§

fn event_sources() -> Vec<&'static str>

Get all the event sources for this payload type

This is intended for internal use only. If all the items in SOURCES are Some(), the function returns the inner strings with duplicates removed. If any item is None (indicating a supported event may come from any source), an empty vector is returned (again, indicating all sources).

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§

§

impl AnyEventPayload for RawEvent<'_>

§

const SOURCES: &'static [Option<&'static str>]

§

const EVENT_TYPES: &'static [u16]

Source§

impl<'a, P, A> AnyEventPayload for AnyPluginEvent<'a, P, A>
where for<'b> P: EventSource + ToBytes + FromBytes<'b> + Debug, A: EventSource + ToBytes + FromBytes<'a> + Debug,

Source§

const SOURCES: &'static [Option<&'static str>]

Source§

const EVENT_TYPES: &'static [u16]

§

impl<T> AnyEventPayload for Event<T>
where T: AnyEventPayload,

§

const SOURCES: &'static [Option<&'static str>] = T::SOURCES

§

const EVENT_TYPES: &'static [u16] = T::EVENT_TYPES

§

impl<T> AnyEventPayload for T
where T: EventPayload,

§

const SOURCES: &'static [Option<&'static str>]

§

const EVENT_TYPES: &'static [u16]