perf(body): avoid boxing Streams twice
This commit is contained in:
committed by
Sean McArthur
parent
bc6af88a32
commit
c3c35e866c
16
src/body.rs
16
src/body.rs
@@ -421,15 +421,17 @@ impl From<Chunk> for Body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S> From<Box<S>> for Body
|
impl
|
||||||
where
|
From<Box<Stream<Item = Chunk, Error = Box<::std::error::Error + Send + Sync>> + Send + 'static>>
|
||||||
S: Stream + Send + 'static,
|
for Body
|
||||||
S::Error: Into<Box<::std::error::Error + Send + Sync>>,
|
|
||||||
Chunk: From<S::Item>,
|
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from(stream: Box<S>) -> Body {
|
fn from(
|
||||||
Body::wrap_stream(stream)
|
stream: Box<
|
||||||
|
Stream<Item = Chunk, Error = Box<::std::error::Error + Send + Sync>> + Send + 'static,
|
||||||
|
>,
|
||||||
|
) -> Body {
|
||||||
|
Body::new(Kind::Wrapped(stream))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user