From ccc7c25334d54c31147b6d80b3560324963fba14 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Wed, 10 Jul 2019 14:17:36 -0700 Subject: [PATCH] chore(body): re-enable Body::wrap_stream --- src/body/body.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/body/body.rs b/src/body/body.rs index cfce01ea..a72a6fab 100644 --- a/src/body/body.rs +++ b/src/body/body.rs @@ -3,8 +3,9 @@ use std::error::Error as StdError; use std::fmt; use bytes::Bytes; -use futures_core::Stream; +use futures_core::{Stream, TryStream}; use futures_channel::{mpsc, oneshot}; +use futures_util::TryStreamExt; use tokio_buf::SizeHint; use h2; use http::HeaderMap; @@ -119,7 +120,6 @@ impl Body { (tx, rx) } - /* /// Wrap a futures `Stream` in a box inside `Body`. /// /// # Example @@ -142,14 +142,13 @@ impl Body { /// ``` pub fn wrap_stream(stream: S) -> Body where - S: Stream + Send + 'static, + S: TryStream + Send + 'static, S::Error: Into>, - Chunk: From, + Chunk: From, { - let mapped = stream.map(Chunk::from).map_err(Into::into); - Body::new(Kind::Wrapped(Box::new(mapped))) + let mapped = stream.map_ok(Chunk::from).map_err(Into::into); + Body::new(Kind::Wrapped(Box::pin(mapped))) } - */ /// dox pub async fn next(&mut self) -> Option> {