pub fn counting_stream<S, E>(
stream: S,
) -> (Arc<AtomicU64>, impl Stream<Item = Result<Bytes, E>>)where
S: Stream<Item = Result<Bytes, E>>,Expand description
Wraps a stream to count the total bytes yielded by successful chunks.
Returns the shared counter and the wrapped stream. The counter is incremented as the stream is consumed, so read it only after the stream is exhausted.