Skip to main content

tee

Function tee 

Source
pub fn tee<S>(upstream: S) -> (impl Stream<Item = ClientChunk>, TapReceiver)
where S: Stream<Item = Result<Bytes, Error>> + Send + 'static,
Expand description

Splits an upstream byte stream into:

  • the returned Stream that forwards every chunk to the HTTP client (no buffering — the stream is forwarded as it arrives, preserving TTFT)
  • a TapReceiver that yields a (cheap, Arc-backed) clone of every chunk for background reassembly. If the tap channel fills up the chunk is dropped — the client copy is never delayed by the tap.