Skip to main content

EventSource

Trait EventSource 

Source
pub trait EventSource: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn subscribe<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = TriggerEvent> + Send>>, AdkError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
}
Available on crate features agents and ambient only.
Expand description

A source of trigger events for ambient agents.

Implementations produce an async stream of TriggerEvents. The stream yields events until the source is stopped or the subscription is dropped.

§Built-in Implementations

Required Methods§

Source

fn name(&self) -> &str

Human-readable name for this event source.

Source

fn subscribe<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = TriggerEvent> + Send>>, AdkError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Subscribe to the event stream.

Returns a stream that yields trigger events until the source is stopped or the subscription is dropped.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§