fix(tonic): Remove Sync requirement for streams (#804)
This commit is contained in:
@@ -57,7 +57,7 @@ pub fn generate<T: Service>(
|
||||
impl<T> #service_ident<T>
|
||||
where
|
||||
T: tonic::client::GrpcService<tonic::body::BoxBody>,
|
||||
T::ResponseBody: Body + Send + Sync + 'static,
|
||||
T::ResponseBody: Body + Send + 'static,
|
||||
T::Error: Into<StdError>,
|
||||
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
|
||||
{
|
||||
@@ -203,8 +203,8 @@ fn generate_server_streaming<T: Method>(
|
||||
tonic::Status::new(tonic::Code::Unknown, format!("Service was not ready: {}", e.into()))
|
||||
})?;
|
||||
let codec = #codec_name::default();
|
||||
let path = http::uri::PathAndQuery::from_static(#path);
|
||||
self.inner.server_streaming(request.into_request(), path, codec).await
|
||||
let path = http::uri::PathAndQuery::from_static(#path);
|
||||
self.inner.server_streaming(request.into_request(), path, codec).await
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -255,8 +255,8 @@ fn generate_streaming<T: Method>(
|
||||
tonic::Status::new(tonic::Code::Unknown, format!("Service was not ready: {}", e.into()))
|
||||
})?;
|
||||
let codec = #codec_name::default();
|
||||
let path = http::uri::PathAndQuery::from_static(#path);
|
||||
self.inner.streaming(request.into_streaming_request(), path, codec).await
|
||||
let path = http::uri::PathAndQuery::from_static(#path);
|
||||
self.inner.streaming(request.into_streaming_request(), path, codec).await
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ pub fn generate<T: Service>(
|
||||
impl<T, B> tonic::codegen::Service<http::Request<B>> for #server_service<T>
|
||||
where
|
||||
T: #server_trait,
|
||||
B: Body + Send + Sync + 'static,
|
||||
B: Body + Send + 'static,
|
||||
B::Error: Into<StdError> + Send + 'static,
|
||||
{
|
||||
type Response = http::Response<tonic::body::BoxBody>;
|
||||
@@ -232,7 +232,7 @@ fn generate_trait_methods<T: Service>(
|
||||
|
||||
quote! {
|
||||
#stream_doc
|
||||
type #stream: futures_core::Stream<Item = Result<#res_message, tonic::Status>> + Send + Sync + 'static;
|
||||
type #stream: futures_core::Stream<Item = Result<#res_message, tonic::Status>> + Send + 'static;
|
||||
|
||||
#method_doc
|
||||
async fn #name(&self, request: tonic::Request<#req_message>)
|
||||
@@ -248,7 +248,7 @@ fn generate_trait_methods<T: Service>(
|
||||
|
||||
quote! {
|
||||
#stream_doc
|
||||
type #stream: futures_core::Stream<Item = Result<#res_message, tonic::Status>> + Send + Sync + 'static;
|
||||
type #stream: futures_core::Stream<Item = Result<#res_message, tonic::Status>> + Send + 'static;
|
||||
|
||||
#method_doc
|
||||
async fn #name(&self, request: tonic::Request<tonic::Streaming<#req_message>>)
|
||||
|
||||
Reference in New Issue
Block a user