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§
Required Methods§
Sourcefn stream(
&mut self,
config: StreamConfig,
) -> SynthResult<(Receiver<StreamEvent<Self::Item>>, Arc<StreamControl>)>
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.
Sourcefn stream_with_progress<F>(
&mut self,
config: StreamConfig,
on_progress: F,
) -> 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>)>
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.