Skip to main content

tee_stream

Function tee_stream 

Source
pub fn tee_stream<S, B, E>(
    inner: S,
    scanner: Scanner,
) -> impl Stream<Item = Result<B, E>> + Send + 'static
where S: Stream<Item = Result<B, E>> + Send + Unpin + 'static, B: AsRef<[u8]> + Send + 'static, E: Send + 'static,
Expand description

Wraps a response byte stream so every chunk is forwarded byte-for-byte while a Scanner observes it; on stream end the merged usage is recorded. Memory overhead is one buffered SSE line, never the whole response.