Skip to main content

StreamingProtocolExecutor

Trait StreamingProtocolExecutor 

Source
pub trait StreamingProtocolExecutor {
    type PreparedData: Clone + Debug + Send + Sync;

    // Required method
    fn execute_stream(
        &mut self,
        data: &Self::PreparedData,
        context: &ExecutionContext,
        sender: Sender<StreamChunk>,
    ) -> impl Future<Output = Result<StreamMeta>> + Send;
}
Expand description

Contract for protocol executors that support streaming output.

Instead of buffering the full response, the executor sends individual chunks through the provided mpsc::Sender as they arrive.

Required Associated Types§

Source

type PreparedData: Clone + Debug + Send + Sync

Protocol-specific prepared data.

Required Methods§

Source

fn execute_stream( &mut self, data: &Self::PreparedData, context: &ExecutionContext, sender: Sender<StreamChunk>, ) -> impl Future<Output = Result<StreamMeta>> + Send

Execute a streaming request, sending chunks through sender. Returns metadata about the completed stream.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§