Skip to main content

StreamingGenerator

Trait StreamingGenerator 

Source
pub trait StreamingGenerator {
    type Item: Clone + Send + 'static;

    // Required methods
    fn stream(
        &mut self,
        config: StreamConfig,
    ) -> SynthResult<(Receiver<StreamEvent<Self::Item>>, Arc<StreamControl>)>;
    fn stream_with_progress<F>(
        &mut self,
        config: StreamConfig,
        on_progress: F,
    ) -> SynthResult<(Receiver<StreamEvent<Self::Item>>, Arc<StreamControl>)>
       where F: Fn(&StreamProgress) + Send + Sync + 'static;
}
Expand description

Trait for generators that support streaming output.

Extends the basic Generator trait with streaming capabilities, including backpressure handling and progress reporting.

Required Associated Types§

Source

type Item: Clone + Send + 'static

The type of items this generator produces.

Required Methods§

Source

fn stream( &mut self, config: StreamConfig, ) -> SynthResult<(Receiver<StreamEvent<Self::Item>>, Arc<StreamControl>)>

Starts streaming generation.

Returns a receiver for stream events and a control handle.

Source

fn stream_with_progress<F>( &mut self, config: StreamConfig, on_progress: F, ) -> SynthResult<(Receiver<StreamEvent<Self::Item>>, Arc<StreamControl>)>
where F: Fn(&StreamProgress) + Send + Sync + 'static,

Streams generation with a custom progress callback.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§