From 9fa0c314a58483a9d3bd429042ba4d80c06fb6ed Mon Sep 17 00:00:00 2001 From: Lucio Franco Date: Fri, 16 Aug 2019 15:06:03 -0400 Subject: [PATCH] wip --- tonic-macros/src/service.rs | 13 +++++++------ tonic/tests/server.rs | 6 ++++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/tonic-macros/src/service.rs b/tonic-macros/src/service.rs index 9026215..3981852 100644 --- a/tonic-macros/src/service.rs +++ b/tonic-macros/src/service.rs @@ -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 tonic::server::ClientStreamingService for #service_ident where S: Stream> + Unpin + Send + 'static { @@ -271,12 +271,13 @@ fn generate_client_streaming( type Future = BoxFuture, tonic::Status>; fn call(&mut self, request: tonic::Request) -> 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!() } } diff --git a/tonic/tests/server.rs b/tonic/tests/server.rs index 38bd6ac..15ffed4 100644 --- a/tonic/tests/server.rs +++ b/tonic/tests/server.rs @@ -37,10 +37,12 @@ struct SayHelloStream; impl ClientStreamingService for SayHelloStream where S: Stream> + Unpin + Send + 'static { type Response = HelloReply; - type Future = impl Future, Status>>; + // type Future = impl Future, Status>>; + type Future = Pin, Status>> + Send + 'static>>; fn call(&mut self, _: Request) -> 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) } }