Skip to main content

EventQueueWriter

Trait EventQueueWriter 

Source
pub trait EventQueueWriter:
    Send
    + Sync
    + 'static {
    // Required methods
    fn write<'a>(
        &'a self,
        event: StreamResponse,
    ) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>;
    fn close<'a>(
        &'a self,
    ) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>;
}
Expand description

Trait for writing streaming events.

Object-safe; used as &dyn EventQueueWriter in the executor.

Required Methods§

Source

fn write<'a>( &'a self, event: StreamResponse, ) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>

Writes a streaming event to the queue.

§Errors

Returns an A2aError if no receivers are active.

Source

fn close<'a>( &'a self, ) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>

Signals that no more events will be written.

§Errors

Returns an A2aError if closing fails.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§