pub struct EventRegistry { /* private fields */ }Expand description
Event registry - manages event handlers and emitted events
Implementations§
Source§impl EventRegistry
impl EventRegistry
pub fn new() -> Self
Sourcepub fn register_handler(&mut self, handler: EventHandler)
pub fn register_handler(&mut self, handler: EventHandler)
Register an event handler
Sourcepub fn emit(
&mut self,
event_name: String,
data: HashMap<String, Value>,
timestamp: f32,
)
pub fn emit( &mut self, event_name: String, data: HashMap<String, Value>, timestamp: f32, )
Emit an event with optional data
Sourcepub fn get_handlers(&self, event_name: &str) -> Vec<EventHandler>
pub fn get_handlers(&self, event_name: &str) -> Vec<EventHandler>
Get handlers for a specific event
Sourcepub fn get_handlers_matching(&self, pattern: &str) -> Vec<EventHandler>
pub fn get_handlers_matching(&self, pattern: &str) -> Vec<EventHandler>
Get all handlers matching a pattern (supports wildcards)
Sourcepub fn should_execute_once(
&mut self,
event_name: &str,
handler_index: usize,
) -> bool
pub fn should_execute_once( &mut self, event_name: &str, handler_index: usize, ) -> bool
Check if a “once” handler should be executed
Sourcepub fn get_emitted_events(&self) -> &[EventPayload]
pub fn get_emitted_events(&self) -> &[EventPayload]
Get all emitted events
Sourcepub fn get_events_by_name(&self, event_name: &str) -> Vec<EventPayload>
pub fn get_events_by_name(&self, event_name: &str) -> Vec<EventPayload>
Get emitted events for a specific event name
Sourcepub fn clear_events(&mut self)
pub fn clear_events(&mut self)
Clear all emitted events (useful for new playback runs)
Sourcepub fn handler_count(&self, event_name: &str) -> usize
pub fn handler_count(&self, event_name: &str) -> usize
Get number of handlers for an event
Sourcepub fn remove_handlers(&mut self, event_name: &str)
pub fn remove_handlers(&mut self, event_name: &str)
Remove all handlers for an event
Trait Implementations§
Source§impl Clone for EventRegistry
impl Clone for EventRegistry
Source§fn clone(&self) -> EventRegistry
fn clone(&self) -> EventRegistry
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EventRegistry
impl Debug for EventRegistry
Source§impl Default for EventRegistry
impl Default for EventRegistry
Source§fn default() -> EventRegistry
fn default() -> EventRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for EventRegistry
impl RefUnwindSafe for EventRegistry
impl Send for EventRegistry
impl Sync for EventRegistry
impl Unpin for EventRegistry
impl UnwindSafe for EventRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more