File tree 1 file changed +6
-7
lines changed
1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -3,8 +3,9 @@ use std::error::Error as StdError;
3
3
use std:: fmt;
4
4
5
5
use bytes:: Bytes ;
6
- use futures_core:: Stream ;
6
+ use futures_core:: { Stream , TryStream } ;
7
7
use futures_channel:: { mpsc, oneshot} ;
8
+ use futures_util:: TryStreamExt ;
8
9
use tokio_buf:: SizeHint ;
9
10
use h2;
10
11
use http:: HeaderMap ;
@@ -119,7 +120,6 @@ impl Body {
119
120
( tx, rx)
120
121
}
121
122
122
- /*
123
123
/// Wrap a futures `Stream` in a box inside `Body`.
124
124
///
125
125
/// # Example
@@ -142,14 +142,13 @@ impl Body {
142
142
/// ```
143
143
pub fn wrap_stream < S > ( stream : S ) -> Body
144
144
where
145
- S: Stream + Send + 'static,
145
+ S : TryStream + Send + ' static ,
146
146
S :: Error : Into < Box < dyn StdError + Send + Sync > > ,
147
- Chunk: From<S::Item >,
147
+ Chunk : From < S :: Ok > ,
148
148
{
149
- let mapped = stream.map (Chunk::from).map_err(Into::into);
150
- Body::new(Kind::Wrapped(Box::new (mapped)))
149
+ let mapped = stream. map_ok ( Chunk :: from) . map_err ( Into :: into) ;
150
+ Body :: new ( Kind :: Wrapped ( Box :: pin ( mapped) ) )
151
151
}
152
- */
153
152
154
153
/// dox
155
154
pub async fn next ( & mut self ) -> Option < crate :: Result < Chunk > > {
You can’t perform that action at this time.
0 commit comments