@@ -148,7 +148,7 @@ impl<'a> MethodGen<'a> {
148
148
& format ! ( "struct {}Method {{" , self . struct_name( ) ) ,
149
149
"}" ,
150
150
|w| {
151
- w. write_line ( & format ! (
151
+ w. write_line ( format ! (
152
152
"service: Arc<dyn {} + Send + Sync>," ,
153
153
self . service_name
154
154
) ) ;
@@ -167,7 +167,7 @@ impl<'a> MethodGen<'a> {
167
167
|w| {
168
168
w. block ( "fn handler(&self, ctx: ::ttrpc::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<()> {" , "}" ,
169
169
|w| {
170
- w. write_line ( & format ! ( "::ttrpc::request_handler!(self, ctx, req, {}, {}, {});" ,
170
+ w. write_line ( format ! ( "::ttrpc::request_handler!(self, ctx, req, {}, {}, {});" ,
171
171
proto_path_to_rust_mod( self . root_scope. find_message( self . proto. get_input_type( ) ) . get_scope( ) . get_file_descriptor( ) . get_name( ) ) ,
172
172
self . root_scope. find_message( self . proto. get_input_type( ) ) . rust_name( ) ,
173
173
self . name( ) ) ) ;
@@ -184,7 +184,7 @@ impl<'a> MethodGen<'a> {
184
184
|w| {
185
185
w. block ( "async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, req: ::ttrpc::Request) -> ::ttrpc::Result<::ttrpc::Response> {" , "}" ,
186
186
|w| {
187
- w. write_line ( & format ! ( "::ttrpc::async_request_handler!(self, ctx, req, {}, {}, {});" ,
187
+ w. write_line ( format ! ( "::ttrpc::async_request_handler!(self, ctx, req, {}, {}, {});" ,
188
188
proto_path_to_rust_mod( self . root_scope. find_message( self . proto. get_input_type( ) ) . get_scope( ) . get_file_descriptor( ) . get_name( ) ) ,
189
189
self . root_scope. find_message( self . proto. get_input_type( ) ) . rust_name( ) ,
190
190
self . name( ) ) ) ;
@@ -197,7 +197,7 @@ impl<'a> MethodGen<'a> {
197
197
|w| {
198
198
w. block ( "async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, inner: ::ttrpc::r#async::StreamInner) -> ::ttrpc::Result<Option<::ttrpc::Response>> {" , "}" ,
199
199
|w| {
200
- w. write_line ( & format ! ( "::ttrpc::async_client_streamimg_handler!(self, ctx, inner, {});" ,
200
+ w. write_line ( format ! ( "::ttrpc::async_client_streamimg_handler!(self, ctx, inner, {});" ,
201
201
self . name( ) ) ) ;
202
202
} ) ;
203
203
} ) ;
@@ -208,7 +208,7 @@ impl<'a> MethodGen<'a> {
208
208
|w| {
209
209
w. block ( "async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, mut inner: ::ttrpc::r#async::StreamInner) -> ::ttrpc::Result<Option<::ttrpc::Response>> {" , "}" ,
210
210
|w| {
211
- w. write_line ( & format ! ( "::ttrpc::async_server_streamimg_handler!(self, ctx, inner, {}, {}, {});" ,
211
+ w. write_line ( format ! ( "::ttrpc::async_server_streamimg_handler!(self, ctx, inner, {}, {}, {});" ,
212
212
proto_path_to_rust_mod( self . root_scope. find_message( self . proto. get_input_type( ) ) . get_scope( ) . get_file_descriptor( ) . get_name( ) ) ,
213
213
self . root_scope. find_message( self . proto. get_input_type( ) ) . rust_name( ) ,
214
214
self . name( ) ) ) ;
@@ -221,7 +221,7 @@ impl<'a> MethodGen<'a> {
221
221
|w| {
222
222
w. block ( "async fn handler(&self, ctx: ::ttrpc::r#async::TtrpcContext, inner: ::ttrpc::r#async::StreamInner) -> ::ttrpc::Result<Option<::ttrpc::Response>> {" , "}" ,
223
223
|w| {
224
- w. write_line ( & format ! ( "::ttrpc::async_duplex_streamimg_handler!(self, ctx, inner, {});" ,
224
+ w. write_line ( format ! ( "::ttrpc::async_duplex_streamimg_handler!(self, ctx, inner, {});" ,
225
225
self . name( ) ) ) ;
226
226
} ) ;
227
227
} ) ;
@@ -277,8 +277,8 @@ impl<'a> MethodGen<'a> {
277
277
let method_name = self . name ( ) ;
278
278
if let MethodType :: Unary = self . method_type ( ) . 0 {
279
279
w. pub_fn ( & self . unary ( & method_name) , |w| {
280
- w. write_line ( & format ! ( "let mut cres = {}::new();" , self . output( ) ) ) ;
281
- w. write_line ( & format ! (
280
+ w. write_line ( format ! ( "let mut cres = {}::new();" , self . output( ) ) ) ;
281
+ w. write_line ( format ! (
282
282
"::ttrpc::client_request!(self, ctx, req, \" {}.{}\" , \" {}\" , cres);" ,
283
283
self . package_name,
284
284
self . service_name,
@@ -295,8 +295,8 @@ impl<'a> MethodGen<'a> {
295
295
// Unary RPC
296
296
MethodType :: Unary => {
297
297
pub_async_fn ( w, & self . unary ( & method_name) , |w| {
298
- w. write_line ( & format ! ( "let mut cres = {}::new();" , self . output( ) ) ) ;
299
- w. write_line ( & format ! (
298
+ w. write_line ( format ! ( "let mut cres = {}::new();" , self . output( ) ) ) ;
299
+ w. write_line ( format ! (
300
300
"::ttrpc::async_client_request!(self, ctx, req, \" {}.{}\" , \" {}\" , cres);" ,
301
301
self . package_name,
302
302
self . service_name,
@@ -307,7 +307,7 @@ impl<'a> MethodGen<'a> {
307
307
// Client Streaming RPC
308
308
MethodType :: ClientStreaming => {
309
309
pub_async_fn ( w, & self . client_streaming ( & method_name) , |w| {
310
- w. write_line ( & format ! (
310
+ w. write_line ( format ! (
311
311
"::ttrpc::async_client_stream_send!(self, ctx, \" {}.{}\" , \" {}\" );" ,
312
312
self . package_name,
313
313
self . service_name,
@@ -318,7 +318,7 @@ impl<'a> MethodGen<'a> {
318
318
// Server Streaming RPC
319
319
MethodType :: ServerStreaming => {
320
320
pub_async_fn ( w, & self . server_streaming ( & method_name) , |w| {
321
- w. write_line ( & format ! (
321
+ w. write_line ( format ! (
322
322
"::ttrpc::async_client_stream_receive!(self, ctx, req, \" {}.{}\" , \" {}\" );" ,
323
323
self . package_name,
324
324
self . service_name,
@@ -329,7 +329,7 @@ impl<'a> MethodGen<'a> {
329
329
// Bidirectional streaming RPC
330
330
MethodType :: Duplex => {
331
331
pub_async_fn ( w, & self . duplex_streaming ( & method_name) , |w| {
332
- w. write_line ( & format ! (
332
+ w. write_line ( format ! (
333
333
"::ttrpc::async_client_stream!(self, ctx, \" {}.{}\" , \" {}\" );" ,
334
334
self . package_name,
335
335
self . service_name,
@@ -496,13 +496,13 @@ impl<'a> ServiceGen<'a> {
496
496
497
497
fn write_sync_client ( & self , w : & mut CodeWriter ) {
498
498
w. write_line ( "#[derive(Clone)]" ) ;
499
- w. pub_struct ( & self . client_name ( ) , |w| {
499
+ w. pub_struct ( self . client_name ( ) , |w| {
500
500
w. field_decl ( "client" , "::ttrpc::Client" ) ;
501
501
} ) ;
502
502
503
503
w. write_line ( "" ) ;
504
504
505
- w. impl_self_block ( & self . client_name ( ) , |w| {
505
+ w. impl_self_block ( self . client_name ( ) , |w| {
506
506
w. pub_fn ( "new(client: ::ttrpc::Client) -> Self" , |w| {
507
507
w. expr_block ( & self . client_name ( ) , |w| {
508
508
w. write_line ( "client," ) ;
@@ -518,13 +518,13 @@ impl<'a> ServiceGen<'a> {
518
518
519
519
fn write_async_client ( & self , w : & mut CodeWriter ) {
520
520
w. write_line ( "#[derive(Clone)]" ) ;
521
- w. pub_struct ( & self . client_name ( ) , |w| {
521
+ w. pub_struct ( self . client_name ( ) , |w| {
522
522
w. field_decl ( "client" , "::ttrpc::r#async::Client" ) ;
523
523
} ) ;
524
524
525
525
w. write_line ( "" ) ;
526
526
527
- w. impl_self_block ( & self . client_name ( ) , |w| {
527
+ w. impl_self_block ( self . client_name ( ) , |w| {
528
528
w. pub_fn ( "new(client: ::ttrpc::r#async::Client) -> Self" , |w| {
529
529
w. expr_block ( & self . client_name ( ) , |w| {
530
530
w. write_line ( "client," ) ;
0 commit comments