Skip to content

Commit

Permalink
feat(body): add From<Box<Stream>> impl for Body
Browse files Browse the repository at this point in the history
  • Loading branch information
lnicola committed May 2, 2018
1 parent ab3c73f commit 45efba2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,18 @@ impl From<Chunk> for Body {
}
}

impl<S> From<Box<S>> for Body
where
S: Stream + Send + 'static,
S::Error: Into<Box<::std::error::Error + Send + Sync>>,
Chunk: From<S::Item>,
{
#[inline]
fn from(stream: Box<S>) -> Body {
Body::wrap_stream(stream)
}
}

impl From<Bytes> for Body {
#[inline]
fn from (bytes: Bytes) -> Body {
Expand Down

0 comments on commit 45efba2

Please sign in to comment.