pub struct EventEmitter { /* private fields */ }Expand description
Event emitter for sending events to multiple receivers
Implementations§
Source§impl EventEmitter
impl EventEmitter
Sourcepub fn with_handler(handler: EventHandler) -> Self
pub fn with_handler(handler: EventHandler) -> Self
Create with an event handler
Sourcepub fn subscribe(&mut self) -> UnboundedReceiver<WorkflowEvent>
pub fn subscribe(&mut self) -> UnboundedReceiver<WorkflowEvent>
Subscribe to events
Sourcepub fn emit(&self, event: WorkflowEvent)
pub fn emit(&self, event: WorkflowEvent)
Emit an event
Sourcepub fn workflow_started(&self, workflow_id: &str, workflow_type: WorkflowType)
pub fn workflow_started(&self, workflow_id: &str, workflow_type: WorkflowType)
Emit workflow started event
Sourcepub fn workflow_completed(
&self,
workflow_id: &str,
status: StreamingStatus,
duration_ms: u64,
)
pub fn workflow_completed( &self, workflow_id: &str, status: StreamingStatus, duration_ms: u64, )
Emit workflow completed event
Sourcepub fn workflow_failed(&self, workflow_id: &str, error: &str)
pub fn workflow_failed(&self, workflow_id: &str, error: &str)
Emit workflow failed event
Sourcepub fn node_started(&self, node_id: &str, node_type: StreamingNodeType)
pub fn node_started(&self, node_id: &str, node_type: StreamingNodeType)
Emit node started event
Sourcepub fn node_completed(
&self,
node_id: &str,
duration_ms: u64,
state_changes: Vec<String>,
)
pub fn node_completed( &self, node_id: &str, duration_ms: u64, state_changes: Vec<String>, )
Emit node completed event
Sourcepub fn token_delta(
&self,
token: &str,
node_id: Option<&str>,
agent_id: Option<&str>,
)
pub fn token_delta( &self, token: &str, node_id: Option<&str>, agent_id: Option<&str>, )
Emit token delta event
Sourcepub fn agent_handoff(&self, from: &str, to: &str, reason: &str)
pub fn agent_handoff(&self, from: &str, to: &str, reason: &str)
Emit handoff event
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EventEmitter
impl !RefUnwindSafe for EventEmitter
impl Send for EventEmitter
impl Sync for EventEmitter
impl Unpin for EventEmitter
impl UnsafeUnpin for EventEmitter
impl !UnwindSafe for EventEmitter
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> 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