pub struct EventSpaceId<S = ()> { /* private fields */ }Expand description
An event space identifier, optionally tied to its EventSpace type S.
If S is the unit type (), then this means this identifier is not tied to any particular
event space (i.e. it is type-erased).
Implementations§
Source§impl<S> EventSpaceId<S>
impl<S> EventSpaceId<S>
Sourcepub const INVALID_ID: u16 = u16::MAX
pub const INVALID_ID: u16 = u16::MAX
The raw numeric value that represents an invalid event space identifier.
Sourcepub const fn id(&self) -> u16
pub const fn id(&self) -> u16
Returns raw numeric value of this identifier.
The returned value cannot be equal to Self::INVALID_ID.
Sourcepub const fn optional_id(this: &Option<EventSpaceId<S>>) -> u16
pub const fn optional_id(this: &Option<EventSpaceId<S>>) -> u16
Returns the raw numeric value of the given identifier, or Self::INVALID_ID if the
None is passed.
Sourcepub const unsafe fn new_unchecked(id: u16) -> EventSpaceId<S>
pub const unsafe fn new_unchecked(id: u16) -> EventSpaceId<S>
Gets an event space ID from a numerical value, without performing any checks.
§Safety
The caller must ensure the event type is properly associated to the event space S.
The caller must also ensure the ID is not equal to Self::INVALID_ID.
Source§impl EventSpaceId<CoreEventSpace<'_>>
impl EventSpaceId<CoreEventSpace<'_>>
Sourcepub const fn core() -> EventSpaceId<CoreEventSpace<'_>>
pub const fn core() -> EventSpaceId<CoreEventSpace<'_>>
Returns the identifier for the CoreEventSpace.
It is the only event space that has a constant, specific ID designated by the CLAP specification, and which can be retrieved without using an event registry.
Source§impl EventSpaceId
impl EventSpaceId
Sourcepub const fn new(id: u16) -> Option<EventSpaceId>
pub const fn new(id: u16) -> Option<EventSpaceId>
Creates a new, type-erased EventSpaceId from its raw numeric value.
This returns None if the passed value is equal to Self::INVALID_ID.
Sourcepub const unsafe fn into_unchecked<S>(self) -> EventSpaceId<S>
pub const unsafe fn into_unchecked<S>(self) -> EventSpaceId<S>
Turns this unassociated event space ID into one associated with the given event space.
§Safety
The caller must ensure the event type is properly associated to the event space S.
Trait Implementations§
Source§impl<S> Clone for EventSpaceId<S>where
S: Clone,
impl<S> Clone for EventSpaceId<S>where
S: Clone,
Source§fn clone(&self) -> EventSpaceId<S>
fn clone(&self) -> EventSpaceId<S>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more