pub trait EventEmitter<T: Clone + Send + Sync + 'static = ()>:
Send
+ Sync
+ 'static {
// Required methods
fn emit(&self, event_arg: T) -> Result<()>;
fn clone(&self) -> Box<dyn EventEmitter<T>>;
}Required Methods§
Sourcefn emit(&self, event_arg: T) -> Result<()>
fn emit(&self, event_arg: T) -> Result<()>
Emits an event of type T to all registered listeners for the specified event kind.
§Arguments
event_arg: The event data of typeTto be emitted.
§Returns
Ok(())if the event was successfully emitted to all listeners.Err(anyhow::Error)if access to the underlying data structure fails, or if no listeners are found for the event kind.