pub fn body_from_stream<S>(stream: S) -> BoxBodyExpand description
Create a streaming BoxBody from a Stream of Result<Frame<Bytes>, E>.
Use this for Server-Sent Events, chunked responses, or any streaming body.
The stream only needs to be Send — Sync is not required.
§Example
ⓘ
use futures::stream;
use http_body::Frame;
let chunks = stream::iter(vec![
Ok(Frame::data(Bytes::from("chunk 1\n"))),
Ok(Frame::data(Bytes::from("chunk 2\n"))),
]);
let body = body_from_stream(chunks);