diff --git a/tonic/src/codec/decode.rs b/tonic/src/codec/decode.rs index 413afdb45..ba3686818 100644 --- a/tonic/src/codec/decode.rs +++ b/tonic/src/codec/decode.rs @@ -19,7 +19,7 @@ const BUFFER_SIZE: usize = 8 * 1024; /// This will wrap some inner [`Body`] and [`Decoder`] and provide an interface /// to fetch the message stream and trailing metadata pub struct Streaming { - decoder: Box + Send + 'static>, + decoder: Box + Sync + Send + 'static>, body: BoxBody, state: State, direction: Direction, @@ -48,7 +48,7 @@ impl Streaming { B: Body + Send + 'static, B::Data: Into, B::Error: Into, - D: Decoder + Send + 'static, + D: Decoder + Sync + Send + 'static, { Self::new(decoder, body, Direction::Response(status_code)) } @@ -58,7 +58,7 @@ impl Streaming { B: Body + Send + 'static, B::Data: Into, B::Error: Into, - D: Decoder + Send + 'static, + D: Decoder + Sync + Send + 'static, { Self::new(decoder, body, Direction::EmptyResponse) } @@ -68,7 +68,7 @@ impl Streaming { B: Body + Send + 'static, B::Data: Into, B::Error: Into, - D: Decoder + Send + 'static, + D: Decoder + Sync + Send + 'static, { Self::new(decoder, body, Direction::Request) } @@ -78,7 +78,7 @@ impl Streaming { B: Body + Send + 'static, B::Data: Into, B::Error: Into, - D: Decoder + Send + 'static, + D: Decoder + Sync + Send + 'static, { Self { decoder: Box::new(decoder), diff --git a/tonic/src/codec/mod.rs b/tonic/src/codec/mod.rs index c32c729af..3f345fdfd 100644 --- a/tonic/src/codec/mod.rs +++ b/tonic/src/codec/mod.rs @@ -28,9 +28,9 @@ pub trait Codec { type Decode: Send + 'static; /// The encoder that can encode a message. - type Encoder: Encoder + Send + 'static; + type Encoder: Encoder + Sync + Send + 'static; /// The encoder that can decode a message. - type Decoder: Decoder + Send + 'static; + type Decoder: Decoder + Sync + Send + 'static; /// The content type of this codec. ///