Skip to main content

EventEmitter

Struct EventEmitter 

Source
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

Source

pub fn emit(&self, event: Event) -> bool

Emits an event to the owning Channel.

The ClientRunner will receive this event and process it. For Output category events, ClientRunner will send to IOBridge.

§Arguments
  • event - The event to emit
§Returns

true if the event was sent successfully, false if the channel is full or closed.

Source

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
Source

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 display
  • level - Log level (“info”, “warn”, “error”)
Source

pub fn broadcast(&self, signal: Signal) -> bool

Broadcasts a signal to all Components.

Use this when the Component needs to notify all other Components of something (e.g., state change).

§Arguments
  • signal - The signal to broadcast
§Returns

true if the signal was sent successfully.

Source

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.

Source

pub fn source_id(&self) -> &ComponentId

Returns the source Component ID.

Trait Implementations§

Source§

impl Clone for EventEmitter

Source§

fn clone(&self) -> EventEmitter

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EventEmitter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Emitter for EventEmitter

Source§

fn emit_output(&self, message: &str)

Emits an output message (info level). Read more
Source§

fn emit_output_with_level(&self, message: &str, level: &str)

Emits an output message with a specific level. Read more
Source§

fn emit_event(&self, category: &str, operation: &str, payload: Value) -> bool

Emits a custom event (broadcast to all channels). Read more
Source§

fn board_recent(&self, n: usize) -> Vec<Value>

Returns the most recent n Board entries as JSON values. Read more
Source§

fn request( &self, target: &str, operation: &str, payload: Value, timeout_ms: Option<u64>, ) -> Result<Value, String>

Sends a synchronous RPC request to another Component. Read more
Source§

fn is_alive(&self, target_fqn: &str) -> bool

Checks whether a target Component is alive (its runner is still running). Read more
Source§

fn clone_box(&self) -> Box<dyn Emitter>

Clones the emitter into a boxed trait object. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more