Skip to content

Commit

Permalink
Merge pull request hyperium#1505 from lnicola/body-from-stream
Browse files Browse the repository at this point in the history
Add From<Box<Stream>> impl for Body
  • Loading branch information
seanmonstar authored May 3, 2018
2 parents 283d79d + 45efba2 commit a5d2c63
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 a5d2c63

Please sign in to comment.