Skip to main content

EventSink

Trait EventSink 

Source
pub trait EventSink:
    Send
    + Sync
    + 'static {
    // Required method
    fn emit<'life0, 'async_trait>(
        &'life0 self,
        event: AgentEvent,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Abstract consumer of AgentEvents.

Implementations are free to buffer, forward, filter, or discard events. The trait is designed to be object-safe so that a single Box<dyn EventSink> can hold any implementation.

Required Methods§

Source

fn emit<'life0, 'async_trait>( &'life0 self, event: AgentEvent, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Deliver one event to this sink.

Implementations should not panic. If the sink is full or closed, the event may be silently dropped (or an error logged).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§