Skip to main content

StreamConverter

Trait StreamConverter 

Source
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§

Source

fn source(&self) -> &FormatId

Source

fn target(&self) -> &FormatId

Source

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.

Source

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,

Flush any buffered data at end of stream.

Implementors§