Clarify required response body type when routing to tower::Services (#69)

This commit is contained in:
David Pedersen
2021-08-01 15:42:12 +02:00
committed by GitHub
parent 593f3e115f
commit f581e3efb2
3 changed files with 19 additions and 3 deletions
+4 -3
View File
@@ -9,11 +9,12 @@ pub use hyper::body::Body;
/// A boxed [`Body`] trait object.
///
/// This is used in axum as the response body type for applications. Its necessary to unify
/// multiple response bodies types into one.
/// This is used in axum as the response body type for applications. Its
/// necessary to unify multiple response bodies types into one.
pub type BoxBody = http_body::combinators::BoxBody<Bytes, BoxStdError>;
pub(crate) fn box_body<B>(body: B) -> BoxBody
/// Convert a [`http_body::Body`] into a [`BoxBody`].
pub fn box_body<B>(body: B) -> BoxBody
where
B: http_body::Body<Data = Bytes> + Send + Sync + 'static,
B::Error: Into<BoxError>,