pub fn box_body<B>(body: B) -> BoxBodyAvailable on crate feature
http only.Expand description
Erase a concrete HTTP body into a BoxBody.
This unifies several different body types behind a single
Response<BoxBody> type, which is useful for
handlers whose branches produce different bodies (streaming, full, empty,
and so on). Any body whose data is bytes::Bytes and whose error converts
into anyhow::Error, including the infallible EmptyBody and
FullBody, can be boxed.
See BoxBody for a complete example.