@@ -19,7 +19,7 @@ const BUFFER_SIZE: usize = 8 * 1024;
1919/// This will wrap some inner [`Body`] and [`Decoder`] and provide an interface
2020/// to fetch the message stream and trailing metadata
2121pub struct Streaming < T > {
22- decoder : Box < dyn Decoder < Item = T , Error = Status > + Send + ' static > ,
22+ decoder : Box < dyn Decoder < Item = T , Error = Status > + Send + Sync + ' static > ,
2323 body : BoxBody ,
2424 state : State ,
2525 direction : Direction ,
@@ -45,40 +45,40 @@ enum Direction {
4545impl < T > Streaming < T > {
4646 pub ( crate ) fn new_response < B , D > ( decoder : D , body : B , status_code : StatusCode ) -> Self
4747 where
48- B : Body + Send + ' static ,
48+ B : Body + Send + Sync + ' static ,
4949 B :: Data : Into < Bytes > ,
5050 B :: Error : Into < crate :: Error > ,
51- D : Decoder < Item = T , Error = Status > + Send + ' static ,
51+ D : Decoder < Item = T , Error = Status > + Send + Sync + ' static ,
5252 {
5353 Self :: new ( decoder, body, Direction :: Response ( status_code) )
5454 }
5555
5656 pub ( crate ) fn new_empty < B , D > ( decoder : D , body : B ) -> Self
5757 where
58- B : Body + Send + ' static ,
58+ B : Body + Send + Sync + ' static ,
5959 B :: Data : Into < Bytes > ,
6060 B :: Error : Into < crate :: Error > ,
61- D : Decoder < Item = T , Error = Status > + Send + ' static ,
61+ D : Decoder < Item = T , Error = Status > + Send + Sync + ' static ,
6262 {
6363 Self :: new ( decoder, body, Direction :: EmptyResponse )
6464 }
6565
6666 pub ( crate ) fn new_request < B , D > ( decoder : D , body : B ) -> Self
6767 where
68- B : Body + Send + ' static ,
68+ B : Body + Send + Sync + ' static ,
6969 B :: Data : Into < Bytes > ,
7070 B :: Error : Into < crate :: Error > ,
71- D : Decoder < Item = T , Error = Status > + Send + ' static ,
71+ D : Decoder < Item = T , Error = Status > + Send + Sync + ' static ,
7272 {
7373 Self :: new ( decoder, body, Direction :: Request )
7474 }
7575
7676 fn new < B , D > ( decoder : D , body : B , direction : Direction ) -> Self
7777 where
78- B : Body + Send + ' static ,
78+ B : Body + Send + Sync + ' static ,
7979 B :: Data : Into < Bytes > ,
8080 B :: Error : Into < crate :: Error > ,
81- D : Decoder < Item = T , Error = Status > + Send + ' static ,
81+ D : Decoder < Item = T , Error = Status > + Send + Sync + ' static ,
8282 {
8383 Self {
8484 decoder : Box :: new ( decoder) ,
@@ -291,3 +291,6 @@ impl<T> fmt::Debug for Streaming<T> {
291291 f. debug_struct ( "Streaming" ) . finish ( )
292292 }
293293}
294+
295+ #[ cfg( test) ]
296+ static_assertions:: assert_impl_all!( Streaming <( ) >: Send , Sync ) ;
0 commit comments