pub struct EventEmitter { /* private fields */ }Expand description
Event emitter for Components.
Allows Components to emit events to their owning Channel or broadcast signals to all Components.
Output events can be routed to a separate IO channel when configured, enabling ChannelRunner components to display output via ClientRunner.
Implementations§
Source§impl EventEmitter
impl EventEmitter
Sourcepub fn emit_output(&self, message: &str)
pub fn emit_output(&self, message: &str)
Emits an Output event with a message.
If an output channel is configured (via with_output_channel),
the event is sent there. Otherwise, it’s sent to the owning channel.
ClientRunner will send this to IOBridge for display.
§Arguments
message- The message to display
Sourcepub fn emit_output_with_level(&self, message: &str, level: &str)
pub fn emit_output_with_level(&self, message: &str, level: &str)
Emits an Output event with a specific level.
If an output channel is configured, sends there; otherwise to owning channel.
§Arguments
message- The message to displaylevel- Log level (“info”, “warn”, “error”)
Sourcepub fn emit_event(
&self,
category: &str,
operation: &str,
payload: Value,
) -> bool
pub fn emit_event( &self, category: &str, operation: &str, payload: Value, ) -> bool
Broadcasts a custom Extension event to all registered channels.
Creates an Extension { namespace: "lua", kind: category } event
and broadcasts it to all channels via shared handles. Channels
subscribed to the matching Extension category will process it.
Falls back to emitting to own channel if shared handles are not set.
§Arguments
category- Extension kind string (e.g., “tool:result”)operation- Operation name (e.g., “complete”)payload- Event payload data
§Returns
true if at least one channel received the event.
Sourcepub fn source_id(&self) -> &ComponentId
pub fn source_id(&self) -> &ComponentId
Returns the source Component ID.
Trait Implementations§
Source§impl Clone for EventEmitter
impl Clone for EventEmitter
Source§fn clone(&self) -> EventEmitter
fn clone(&self) -> EventEmitter
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EventEmitter
impl Debug for EventEmitter
Source§impl Emitter for EventEmitter
impl Emitter for EventEmitter
Source§fn emit_output(&self, message: &str)
fn emit_output(&self, message: &str)
Source§fn emit_output_with_level(&self, message: &str, level: &str)
fn emit_output_with_level(&self, message: &str, level: &str)
Source§fn emit_event(&self, category: &str, operation: &str, payload: Value) -> bool
fn emit_event(&self, category: &str, operation: &str, payload: Value) -> bool
Source§fn board_recent(&self, n: usize) -> Vec<Value>
fn board_recent(&self, n: usize) -> Vec<Value>
n Board entries as JSON values. Read more