@@ -61,25 +61,25 @@ pub(crate) fn generate(config: &GrpcConfig, service: &Service, buf: &mut String)
61
61
match ( method. client_streaming , method. server_streaming ) {
62
62
( false , false ) => {
63
63
trait_methods. push ( quote ! {
64
- async fn #method_ident( & self , request: #crate_name:: Request <#input_type>) -> :: std:: result:: Result <#crate_name:: Response <#output_type>, #crate_name:: Status >;
64
+ fn #method_ident( & self , request: #crate_name:: Request <#input_type>) -> impl :: std:: future :: Future < Output = :: std :: result:: Result <#crate_name:: Response <#output_type>, #crate_name:: Status >> + Send ;
65
65
} ) ;
66
66
endpoints. push ( generate_unary ( & codec_list, method_info) ) ;
67
67
}
68
68
( true , false ) => {
69
69
trait_methods. push ( quote ! {
70
- async fn #method_ident( & self , request: #crate_name:: Request <#crate_name:: Streaming <#input_type>>) -> :: std:: result:: Result <#crate_name:: Response <#output_type>, #crate_name:: Status >;
70
+ fn #method_ident( & self , request: #crate_name:: Request <#crate_name:: Streaming <#input_type>>) -> impl :: std:: future :: Future < Output = :: std :: result:: Result <#crate_name:: Response <#output_type>, #crate_name:: Status >> + Send ;
71
71
} ) ;
72
72
endpoints. push ( generate_client_streaming ( & codec_list, method_info) ) ;
73
73
}
74
74
( false , true ) => {
75
75
trait_methods. push ( quote ! {
76
- async fn #method_ident( & self , request: #crate_name:: Request <#input_type>) -> :: std:: result:: Result <#crate_name:: Response <#crate_name:: Streaming <#output_type>>, #crate_name:: Status >;
76
+ fn #method_ident( & self , request: #crate_name:: Request <#input_type>) -> impl :: std:: future :: Future < Output = :: std :: result:: Result <#crate_name:: Response <#crate_name:: Streaming <#output_type>>, #crate_name:: Status >> + Send ;
77
77
} ) ;
78
78
endpoints. push ( generate_server_streaming ( & codec_list, method_info) ) ;
79
79
}
80
80
( true , true ) => {
81
81
trait_methods. push ( quote ! {
82
- async fn #method_ident( & self , request: #crate_name:: Request <#crate_name:: Streaming <#input_type>>) -> :: std:: result:: Result <#crate_name:: Response <#crate_name:: Streaming <#output_type>>, #crate_name:: Status >;
82
+ fn #method_ident( & self , request: #crate_name:: Request <#crate_name:: Streaming <#input_type>>) -> impl :: std:: future :: Future < Output = :: std :: result:: Result <#crate_name:: Response <#crate_name:: Streaming <#output_type>>, #crate_name:: Status >> + Send ;
83
83
} ) ;
84
84
endpoints. push ( generate_bidirectional_streaming ( & codec_list, method_info) ) ;
85
85
}
@@ -94,7 +94,6 @@ pub(crate) fn generate(config: &GrpcConfig, service: &Service, buf: &mut String)
94
94
95
95
let token_stream = quote ! {
96
96
#[ allow( unused_imports) ]
97
- #[ :: poem:: async_trait]
98
97
pub trait #service_ident: Send + Sync + ' static {
99
98
#( #trait_methods) *
100
99
}
@@ -200,7 +199,6 @@ fn generate_unary(codec_list: &[Path], method_info: MethodInfo) -> TokenStream {
200
199
#[ allow( non_camel_case_types) ]
201
200
struct #proxy_service_ident<T >( :: std:: sync:: Arc <T >) ;
202
201
203
- #[ :: poem:: async_trait]
204
202
impl <T : #service_ident> #crate_name:: service:: UnaryService <#input_type> for #proxy_service_ident<T > {
205
203
type Response = #output_type;
206
204
@@ -245,7 +243,6 @@ fn generate_client_streaming(codec_list: &[Path], method_info: MethodInfo) -> To
245
243
#[ allow( non_camel_case_types) ]
246
244
struct #proxy_service_ident<T >( :: std:: sync:: Arc <T >) ;
247
245
248
- #[ :: poem:: async_trait]
249
246
impl <T : #service_ident> #crate_name:: service:: ClientStreamingService <#input_type> for #proxy_service_ident<T > {
250
247
type Response = #output_type;
251
248
@@ -290,7 +287,6 @@ fn generate_server_streaming(codec_list: &[Path], method_info: MethodInfo) -> To
290
287
#[ allow( non_camel_case_types) ]
291
288
struct #proxy_service_ident<T >( :: std:: sync:: Arc <T >) ;
292
289
293
- #[ :: poem:: async_trait]
294
290
impl <T : #service_ident> #crate_name:: service:: ServerStreamingService <#input_type> for #proxy_service_ident<T > {
295
291
type Response = #output_type;
296
292
@@ -335,7 +331,6 @@ fn generate_bidirectional_streaming(codec_list: &[Path], method_info: MethodInfo
335
331
#[ allow( non_camel_case_types) ]
336
332
struct #proxy_service_ident<T >( :: std:: sync:: Arc <T >) ;
337
333
338
- #[ :: poem:: async_trait]
339
334
impl <T : #service_ident> #crate_name:: service:: BidirectionalStreamingService <#input_type> for #proxy_service_ident<T > {
340
335
type Response = #output_type;
341
336
0 commit comments