pub trait StreamConverter: Send + Sync {
// Required methods
fn source(&self) -> &FormatId;
fn target(&self) -> &FormatId;
fn convert_chunk<'life0, 'async_trait>(
&'life0 self,
chunk: Bytes,
) -> Pin<Box<dyn Future<Output = ProxyResult<Vec<Bytes>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn flush<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ProxyResult<Vec<Bytes>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Converts streaming data chunk-by-chunk (for SSE, WebSocket, etc.).
Required Methods§
fn source(&self) -> &FormatId
fn target(&self) -> &FormatId
Sourcefn convert_chunk<'life0, 'async_trait>(
&'life0 self,
chunk: Bytes,
) -> Pin<Box<dyn Future<Output = ProxyResult<Vec<Bytes>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn convert_chunk<'life0, 'async_trait>(
&'life0 self,
chunk: Bytes,
) -> Pin<Box<dyn Future<Output = ProxyResult<Vec<Bytes>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Process one chunk, returning zero or more output chunks.