pub fn encode_stream<'b, S, T, ENC>(
stream: S,
encoder: ENC,
) -> impl Stream<Item = Result<Bytes, StreamError>> + Send + 'bwhere
S: Stream<Item = Result<T, StreamError>> + Send + Unpin + 'b,
T: Send + 'b,
ENC: ItemEncoder<T> + Send + 'b,Expand description
Encode a stream of items into a stream of body chunks.
Empty chunks are swallowed rather than yielded, so a format with no prologue or epilogue does not emit zero-length frames.
The returned stream is fused, so an extra poll after the end yields None rather than
panicking. Bodies are polled once more after their last frame, and errors reach the
terminal phase early, which makes the over-poll ordinary rather than exceptional.