mirror of
https://github.com/tokio-rs/axum.git
synced 2026-09-08 00:00:24 +02:00
Remove boxing from StreamBody (#241)
I just had a thought: Why should `response::Headers` be generic, but `body::StreamBody` should not? `StreamBody` previously boxed the stream to erase the generics. So we had `response::Headers<T>` but `body::StreamBody`, without generics. After thinking about it I think it actually makes sense for responses to remain generic because you're able to use `impl IntoResponse` so you don't have to name the generics. Whereas in the case of `BodyStream` (an extractor) you cannot use `impl Trait` so it makes sense to box the inner body to make the type easier to name. Besides, `BodyStream` is mostly useful when the request body isn't `hyper::Body`, as that already implements `Stream`.
This commit is contained in:
@@ -198,7 +198,6 @@ macro_rules! impl_into_response_for_body {
|
||||
impl_into_response_for_body!(hyper::Body);
|
||||
impl_into_response_for_body!(Full<Bytes>);
|
||||
impl_into_response_for_body!(Empty<Bytes>);
|
||||
impl_into_response_for_body!(crate::body::StreamBody);
|
||||
|
||||
impl<E> IntoResponse for http_body::combinators::BoxBody<Bytes, E>
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user