@@ -13,15 +13,15 @@ pin_project! {
13
13
pub struct ByteStream {
14
14
size_hint: Option <usize >,
15
15
#[ pin]
16
- inner: Pin <Box <dyn Stream <Item = Result <Bytes , io:: Error >> + Send + Sync + ' static >>,
16
+ inner: Pin <Box <dyn Stream <Item = Result <Bytes , io:: Error >> + Send + ' static >>,
17
17
}
18
18
}
19
19
20
20
impl ByteStream {
21
21
/// Create a new `ByteStream` by wrapping a `futures` stream.
22
22
pub fn new < S > ( stream : S ) -> ByteStream
23
23
where
24
- S : Stream < Item = Result < Bytes , io:: Error > > + Send + Sync + ' static ,
24
+ S : Stream < Item = Result < Bytes , io:: Error > > + Send + ' static ,
25
25
{
26
26
ByteStream {
27
27
size_hint : None ,
@@ -33,7 +33,7 @@ impl ByteStream {
33
33
/// size_hint to satisy S3's `PutObject` API.
34
34
pub fn new_with_size < S > ( stream : S , size_hint : usize ) -> ByteStream
35
35
where
36
- S : Stream < Item = Result < Bytes , io:: Error > > + Send + Sync + ' static ,
36
+ S : Stream < Item = Result < Bytes , io:: Error > > + Send + ' static ,
37
37
{
38
38
ByteStream {
39
39
size_hint : Some ( size_hint) ,
@@ -46,12 +46,12 @@ impl ByteStream {
46
46
}
47
47
48
48
/// Return an implementation of `AsyncRead` that uses async i/o to consume the stream.
49
- pub fn into_async_read ( self ) -> impl AsyncRead + Send + Sync {
49
+ pub fn into_async_read ( self ) -> impl AsyncRead + Send {
50
50
ImplAsyncRead :: new ( self . inner )
51
51
}
52
52
53
53
/// Return an implementation of `Read` that uses blocking i/o to consume the stream.
54
- pub fn into_blocking_read ( self ) -> impl io:: Read + Send + Sync {
54
+ pub fn into_blocking_read ( self ) -> impl io:: Read + Send {
55
55
ImplBlockingRead :: new ( self . inner )
56
56
}
57
57
}
@@ -84,12 +84,12 @@ pin_project! {
84
84
struct ImplAsyncRead {
85
85
buffer: BytesMut ,
86
86
#[ pin]
87
- stream: futures:: stream:: Fuse <Pin <Box <dyn Stream <Item = Result <Bytes , io:: Error >> + Send + Sync >>>,
87
+ stream: futures:: stream:: Fuse <Pin <Box <dyn Stream <Item = Result <Bytes , io:: Error >> + Send >>>,
88
88
}
89
89
}
90
90
91
91
impl ImplAsyncRead {
92
- fn new ( stream : Pin < Box < dyn Stream < Item = Result < Bytes , io:: Error > > + Send + Sync > > ) -> Self {
92
+ fn new ( stream : Pin < Box < dyn Stream < Item = Result < Bytes , io:: Error > > + Send > > ) -> Self {
93
93
ImplAsyncRead {
94
94
buffer : BytesMut :: new ( ) ,
95
95
stream : stream. fuse ( ) ,
@@ -128,7 +128,7 @@ pin_project! {
128
128
}
129
129
130
130
impl ImplBlockingRead {
131
- fn new ( stream : Pin < Box < dyn Stream < Item = Result < Bytes , io:: Error > > + Send + Sync > > ) -> Self {
131
+ fn new ( stream : Pin < Box < dyn Stream < Item = Result < Bytes , io:: Error > > + Send > > ) -> Self {
132
132
ImplBlockingRead {
133
133
inner : ImplAsyncRead :: new ( stream) ,
134
134
}
@@ -140,7 +140,11 @@ impl io::Read for ImplBlockingRead {
140
140
let rt = tokio:: runtime:: Runtime :: new ( ) ?;
141
141
rt. block_on ( future:: poll_fn ( |cx| {
142
142
let mut buf = ReadBuf :: new ( buf) ;
143
- futures:: ready!( AsyncRead :: poll_read( Pin :: new( & mut self . inner) , cx, & mut buf) ) ?;
143
+ futures:: ready!( AsyncRead :: poll_read(
144
+ Pin :: new( & mut self . inner) ,
145
+ cx,
146
+ & mut buf
147
+ ) ) ?;
144
148
Poll :: Ready ( Ok ( buf. filled ( ) . len ( ) ) )
145
149
} ) )
146
150
}
0 commit comments