Skip to content

Commit 45efba2

Browse files
committed
feat(body): add From<Box<Stream>> impl for Body
1 parent ab3c73f commit 45efba2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/body.rs

+12
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,18 @@ impl From<Chunk> for Body {
421421
}
422422
}
423423

424+
impl<S> From<Box<S>> for Body
425+
where
426+
S: Stream + Send + 'static,
427+
S::Error: Into<Box<::std::error::Error + Send + Sync>>,
428+
Chunk: From<S::Item>,
429+
{
430+
#[inline]
431+
fn from(stream: Box<S>) -> Body {
432+
Body::wrap_stream(stream)
433+
}
434+
}
435+
424436
impl From<Bytes> for Body {
425437
#[inline]
426438
fn from (bytes: Bytes) -> Body {

0 commit comments

Comments
 (0)