Skip to main content

StreamHandler

Trait StreamHandler 

Source
pub trait StreamHandler: Send + Sync {
    // Required method
    fn call_streaming(
        &self,
        args: &str,
        tx: StreamSender,
    ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + '_>>;
}
Expand description

Trait for streaming handlers that send incremental updates during execution.

Parallel to Handler but receives a StreamSender for emitting intermediate messages. The handler returns a final result after streaming completes.

Required Methods§

Source

fn call_streaming( &self, args: &str, tx: StreamSender, ) -> Pin<Box<dyn Future<Output = Result<String, String>> + Send + '_>>

Call the streaming handler with JSON args and a stream sender.

The handler sends intermediate messages via tx and returns a final result when execution completes.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl StreamHandler for ErasedStreamHandler

Source§

impl<F, Fut, R> StreamHandler for StreamingHandlerFn<F, Fut, R>
where F: Fn(StreamSender) -> Fut + Send + Sync + 'static, Fut: Future<Output = R> + Send + 'static, R: IntoHandlerResult + 'static,

Source§

impl<F, S, Fut, R> StreamHandler for StreamingHandlerWithStateOnly<F, S, Fut, R>
where F: Fn(State<Arc<S>>, StreamSender) -> Fut + Send + Sync + 'static, S: Send + Sync + 'static, Fut: Future<Output = R> + Send + 'static, R: IntoHandlerResult + 'static,

Source§

impl<F, S, T, Fut, R> StreamHandler for StreamingHandlerWithState<F, S, T, Fut, R>
where F: Fn(State<Arc<S>>, T, StreamSender) -> Fut + Send + Sync + 'static, S: Send + Sync + 'static, T: DeserializeOwned + Send + 'static, Fut: Future<Output = R> + Send + 'static, R: IntoHandlerResult + 'static,

Source§

impl<F, T, Fut, R> StreamHandler for StreamingHandlerWithArgs<F, T, Fut, R>
where F: Fn(T, StreamSender) -> Fut + Send + Sync + 'static, T: DeserializeOwned + Send + 'static, Fut: Future<Output = R> + Send + 'static, R: IntoHandlerResult + 'static,