Event

Trait Event 

Source
pub trait Event:
    Send
    + Sync
    + Debug {
    // Required methods
    fn source(&self) -> &str;
    fn correlation_id(&self) -> Option<&str>;
    fn set_correlation_id(&mut self, id: String);
    fn as_any(&self) -> &dyn Any;
    fn clone_box(&self) -> Box<dyn Event>;
}
Expand description

Base trait for all events in the agent system.

Events are used to communicate between agents in an asynchronous manner. Each event has a source (the agent that created it) and optionally a correlation_id to track related events through a workflow.

Required Methods§

Source

fn source(&self) -> &str

Returns the source agent identifier

Source

fn correlation_id(&self) -> Option<&str>

Returns the correlation ID if set

Source

fn set_correlation_id(&mut self, id: String)

Sets the correlation ID

Source

fn as_any(&self) -> &dyn Any

Cast to Any for downcasting

Source

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

Clone the event into a Box

Implementors§