This commit is contained in:
Lucio Franco
2019-08-16 15:06:03 -04:00
parent 874dca3843
commit 9fa0c314a5
2 changed files with 11 additions and 8 deletions
+7 -6
View File
@@ -263,7 +263,7 @@ fn generate_client_streaming(
// TODO: parse response stream type, if it is a concrete type then use that
// as the ResponseStream type, if it is a impl Trait then we need to box.
quote! {
struct #service_ident(pub std::sync::Arc<#service_impl>);
struct #service_ident ;//(pub std::sync::Arc<#service_impl>);
impl<S> tonic::server::ClientStreamingService<S> for #service_ident
where S: Stream<Item = Result<#request, Status>> + Unpin + Send + 'static {
@@ -271,12 +271,13 @@ fn generate_client_streaming(
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
fn call(&mut self, request: tonic::Request<S>) -> Self::Future {
let inner = self.0.clone();
let fut = async move {
inner.#method_ident(request).await
// let inner = self.0.clone();
// let fut = async move {
// inner.#method_ident(request).await
};
Box::pin(fut)
// };
// Box::pin(fut)
unimplemented!()
}
}
+4 -2
View File
@@ -37,10 +37,12 @@ struct SayHelloStream;
impl<S> ClientStreamingService<S> for SayHelloStream
where S: Stream<Item = Result<HelloRequest, Status>> + Unpin + Send + 'static {
type Response = HelloReply;
type Future = impl Future<Output = Result<Response<Self::Response>, Status>>;
// type Future = impl Future<Output = Result<Response<Self::Response>, Status>>;
type Future = Pin<Box<dyn Future<Output = Result<Response<Self::Response>, Status>> + Send + 'static>>;
fn call(&mut self, _: Request<S>) -> Self::Future {
async move { Ok(Response::new(HelloReply { message: "hello".into()})) }
let fut = async move { Ok(Response::new(HelloReply { message: "hello".into()})) };
Box::pin(fut)
}
}