Skip to main content

EventSpace

Trait EventSpace 

Source
pub unsafe trait EventSpace<'a>: Sized + 'a {
    const NAME: &'static CStr;

    // Required methods
    unsafe fn from_unknown(event: &'a UnknownEvent) -> Option<Self>;
    fn as_unknown(&self) -> &'a UnknownEvent;
}
Expand description

Holds all the possible event types included in a given event space.

§Safety

The implementers of this trait must ensure the NAME matches the name of the event space coming from the associated CLAP specification.

Required Associated Constants§

Source

const NAME: &'static CStr

The specified name of this event space.

This name MUST match the one defined by the CLAP specification for this event space.

Required Methods§

Source

unsafe fn from_unknown(event: &'a UnknownEvent) -> Option<Self>

Casts the given unknown event to the matching event type.

§Safety

This method does not take the event space ID into consideration. It is up to the caller to ensure that the given event does in fact belong to this event space.

Source

fn as_unknown(&self) -> &'a UnknownEvent

Returns this event as a type-erased UnknownEvent.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'a> EventSpace<'a> for CoreEventSpace<'a>

Source§

const NAME: &'static CStr = c""