mirror of https://github.com/fafhrd91/actix-web
use boxed trait method where appropriate
This commit is contained in:
parent
88a1999c06
commit
240c85260b
|
@ -194,7 +194,7 @@ impl<B> Response<B> {
|
||||||
where
|
where
|
||||||
B: MessageBody + 'static,
|
B: MessageBody + 'static,
|
||||||
{
|
{
|
||||||
self.map_body(|_, body| BoxBody::new(body))
|
self.map_body(|_, body| body.boxed())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns body, consuming this response.
|
/// Returns body, consuming this response.
|
||||||
|
|
|
@ -45,9 +45,7 @@ impl AnyBody {
|
||||||
where
|
where
|
||||||
B: MessageBody + 'static,
|
B: MessageBody + 'static,
|
||||||
{
|
{
|
||||||
Self::Body {
|
Self::Body { body: body.boxed() }
|
||||||
body: BoxBody::new(body),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Constructs new `AnyBody` instance from a slice of bytes by copying it.
|
/// Constructs new `AnyBody` instance from a slice of bytes by copying it.
|
||||||
|
|
|
@ -244,8 +244,7 @@ impl<B> HttpResponse<B> {
|
||||||
where
|
where
|
||||||
B: MessageBody + 'static,
|
B: MessageBody + 'static,
|
||||||
{
|
{
|
||||||
// TODO: avoid double boxing with down-casting, if it improves perf
|
self.map_body(|_, body| body.boxed())
|
||||||
self.map_body(|_, body| BoxBody::new(body))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extract response body
|
/// Extract response body
|
||||||
|
|
|
@ -451,7 +451,7 @@ impl<B> ServiceResponse<B> {
|
||||||
where
|
where
|
||||||
B: MessageBody + 'static,
|
B: MessageBody + 'static,
|
||||||
{
|
{
|
||||||
self.map_body(|_, body| BoxBody::new(body))
|
self.map_body(|_, body| body.boxed())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue