StreamingCallbackHandler

Trait StreamingCallbackHandler 

Source
pub trait StreamingCallbackHandler<T>: Send + Sync {
    // Required methods
    fn tap_output_aiter(
        &self,
        run_id: Uuid,
        output: Pin<Box<dyn Stream<Item = T> + Send>>,
    ) -> Pin<Box<dyn Stream<Item = T> + Send>>;
    fn tap_output_iter(
        &self,
        run_id: Uuid,
        output: Box<dyn Iterator<Item = T> + Send>,
    ) -> Box<dyn Iterator<Item = T> + Send>;
}
Expand description

A trait for streaming callback handlers.

This is a common mixin that the callback handlers for both astream events and astream log inherit from.

The tap_output_aiter method is invoked in some contexts to produce callbacks for intermediate results.

Required Methods§

Source

fn tap_output_aiter( &self, run_id: Uuid, output: Pin<Box<dyn Stream<Item = T> + Send>>, ) -> Pin<Box<dyn Stream<Item = T> + Send>>

Used for internal astream_log and astream events implementations.

Tap the output async iterator to stream its values.

§Arguments
  • run_id - The ID of the run.
  • output - The output async iterator to tap.
§Returns

An async iterator that yields the same values as the input.

Source

fn tap_output_iter( &self, run_id: Uuid, output: Box<dyn Iterator<Item = T> + Send>, ) -> Box<dyn Iterator<Item = T> + Send>

Used for internal astream_log and astream events implementations.

Tap the output iterator to stream its values.

§Arguments
  • run_id - The ID of the run.
  • output - The output iterator to tap.
§Returns

An iterator that yields the same values as the input.

Implementors§