18
18
/// EchoRequest is the request for echo.
19
19
#[ derive( Clone , PartialEq , :: prost:: Message ) ]
20
20
pub struct EchoRequest {
21
- #[ prost( string, tag= "1" ) ]
21
+ #[ prost( string, tag = "1" ) ]
22
22
pub message : :: prost:: alloc:: string:: String ,
23
23
}
24
24
/// EchoResponse is the response for echo.
25
25
#[ derive( Clone , PartialEq , :: prost:: Message ) ]
26
26
pub struct EchoResponse {
27
- #[ prost( string, tag= "1" ) ]
27
+ #[ prost( string, tag = "1" ) ]
28
28
pub message : :: prost:: alloc:: string:: String ,
29
29
}
30
30
/// Generated client implementations.
@@ -64,24 +64,18 @@ pub mod echo_client {
64
64
& mut self ,
65
65
request : Request < super :: EchoRequest > ,
66
66
) -> Result < Response < super :: EchoResponse > , dubbo:: status:: Status > {
67
- let codec = dubbo:: codegen:: ProstCodec :: <
68
- super :: EchoRequest ,
69
- super :: EchoResponse ,
70
- > :: default ( ) ;
71
- let path = http:: uri:: PathAndQuery :: from_static (
72
- "/grpc.examples.echo.Echo/UnaryEcho" ,
73
- ) ;
67
+ let codec =
68
+ dubbo:: codegen:: ProstCodec :: < super :: EchoRequest , super :: EchoResponse > :: default ( ) ;
69
+ let path = http:: uri:: PathAndQuery :: from_static ( "/grpc.examples.echo.Echo/UnaryEcho" ) ;
74
70
self . inner . unary ( request, codec, path) . await
75
71
}
76
72
/// ServerStreamingEcho is server side streaming.
77
73
pub async fn server_streaming_echo (
78
74
& mut self ,
79
75
request : Request < super :: EchoRequest > ,
80
76
) -> Result < Response < Decoding < super :: EchoResponse > > , dubbo:: status:: Status > {
81
- let codec = dubbo:: codegen:: ProstCodec :: <
82
- super :: EchoRequest ,
83
- super :: EchoResponse ,
84
- > :: default ( ) ;
77
+ let codec =
78
+ dubbo:: codegen:: ProstCodec :: < super :: EchoRequest , super :: EchoResponse > :: default ( ) ;
85
79
let path = http:: uri:: PathAndQuery :: from_static (
86
80
"/grpc.examples.echo.Echo/ServerStreamingEcho" ,
87
81
) ;
@@ -92,10 +86,8 @@ pub mod echo_client {
92
86
& mut self ,
93
87
request : impl IntoStreamingRequest < Message = super :: EchoRequest > ,
94
88
) -> Result < Response < super :: EchoResponse > , dubbo:: status:: Status > {
95
- let codec = dubbo:: codegen:: ProstCodec :: <
96
- super :: EchoRequest ,
97
- super :: EchoResponse ,
98
- > :: default ( ) ;
89
+ let codec =
90
+ dubbo:: codegen:: ProstCodec :: < super :: EchoRequest , super :: EchoResponse > :: default ( ) ;
99
91
let path = http:: uri:: PathAndQuery :: from_static (
100
92
"/grpc.examples.echo.Echo/ClientStreamingEcho" ,
101
93
) ;
@@ -106,10 +98,8 @@ pub mod echo_client {
106
98
& mut self ,
107
99
request : impl IntoStreamingRequest < Message = super :: EchoRequest > ,
108
100
) -> Result < Response < Decoding < super :: EchoResponse > > , dubbo:: status:: Status > {
109
- let codec = dubbo:: codegen:: ProstCodec :: <
110
- super :: EchoRequest ,
111
- super :: EchoResponse ,
112
- > :: default ( ) ;
101
+ let codec =
102
+ dubbo:: codegen:: ProstCodec :: < super :: EchoRequest , super :: EchoResponse > :: default ( ) ;
113
103
let path = http:: uri:: PathAndQuery :: from_static (
114
104
"/grpc.examples.echo.Echo/BidirectionalStreamingEcho" ,
115
105
) ;
@@ -130,9 +120,7 @@ pub mod echo_server {
130
120
request : Request < super :: EchoRequest > ,
131
121
) -> Result < Response < super :: EchoResponse > , dubbo:: status:: Status > ;
132
122
///Server streaming response type for the ServerStreamingEcho method.
133
- type ServerStreamingEchoStream : futures_util:: Stream <
134
- Item = Result < super :: EchoResponse , dubbo:: status:: Status > ,
135
- >
123
+ type ServerStreamingEchoStream : futures_util:: Stream < Item = Result < super :: EchoResponse , dubbo:: status:: Status > >
136
124
+ Send
137
125
+ ' static ;
138
126
/// ServerStreamingEcho is server side streaming.
@@ -146,19 +134,14 @@ pub mod echo_server {
146
134
request : Request < Decoding < super :: EchoRequest > > ,
147
135
) -> Result < Response < super :: EchoResponse > , dubbo:: status:: Status > ;
148
136
///Server streaming response type for the BidirectionalStreamingEcho method.
149
- type BidirectionalStreamingEchoStream : futures_util:: Stream <
150
- Item = Result < super :: EchoResponse , dubbo:: status:: Status > ,
151
- >
137
+ type BidirectionalStreamingEchoStream : futures_util:: Stream < Item = Result < super :: EchoResponse , dubbo:: status:: Status > >
152
138
+ Send
153
139
+ ' static ;
154
140
/// BidirectionalStreamingEcho is bidi streaming.
155
141
async fn bidirectional_streaming_echo (
156
142
& self ,
157
143
request : Request < Decoding < super :: EchoRequest > > ,
158
- ) -> Result <
159
- Response < Self :: BidirectionalStreamingEchoStream > ,
160
- dubbo:: status:: Status ,
161
- > ;
144
+ ) -> Result < Response < Self :: BidirectionalStreamingEchoStream > , dubbo:: status:: Status > ;
162
145
}
163
146
/// Echo is the echo service.
164
147
#[ derive( Debug ) ]
@@ -188,10 +171,7 @@ pub mod echo_server {
188
171
type Response = http:: Response < BoxBody > ;
189
172
type Error = std:: convert:: Infallible ;
190
173
type Future = BoxFuture < Self :: Response , Self :: Error > ;
191
- fn poll_ready (
192
- & mut self ,
193
- _cx : & mut Context < ' _ > ,
194
- ) -> Poll < Result < ( ) , Self :: Error > > {
174
+ fn poll_ready ( & mut self , _cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: Error > > {
195
175
Poll :: Ready ( Ok ( ( ) ) )
196
176
}
197
177
fn call ( & mut self , req : http:: Request < B > ) -> Self :: Future {
@@ -204,26 +184,18 @@ pub mod echo_server {
204
184
}
205
185
impl < T : Echo > UnarySvc < super :: EchoRequest > for UnaryEchoServer < T > {
206
186
type Response = super :: EchoResponse ;
207
- type Future = BoxFuture <
208
- Response < Self :: Response > ,
209
- dubbo:: status:: Status ,
210
- > ;
211
- fn call (
212
- & mut self ,
213
- request : Request < super :: EchoRequest > ,
214
- ) -> Self :: Future {
187
+ type Future = BoxFuture < Response < Self :: Response > , dubbo:: status:: Status > ;
188
+ fn call ( & mut self , request : Request < super :: EchoRequest > ) -> Self :: Future {
215
189
let inner = self . inner . 0 . clone ( ) ;
216
190
let fut = async move { inner. unary_echo ( request) . await } ;
217
191
Box :: pin ( fut)
218
192
}
219
193
}
220
194
let fut = async move {
221
- let mut server = TripleServer :: new (
222
- dubbo:: codegen:: ProstCodec :: <
223
- super :: EchoResponse ,
224
- super :: EchoRequest ,
225
- > :: default ( ) ,
226
- ) ;
195
+ let mut server = TripleServer :: new ( dubbo:: codegen:: ProstCodec :: <
196
+ super :: EchoResponse ,
197
+ super :: EchoRequest ,
198
+ > :: default ( ) ) ;
227
199
let res = server. unary ( UnaryEchoServer { inner } , req) . await ;
228
200
Ok ( res)
229
201
} ;
@@ -234,32 +206,22 @@ pub mod echo_server {
234
206
struct ServerStreamingEchoServer < T : Echo > {
235
207
inner : _Inner < T > ,
236
208
}
237
- impl < T : Echo > ServerStreamingSvc < super :: EchoRequest >
238
- for ServerStreamingEchoServer < T > {
209
+ impl < T : Echo > ServerStreamingSvc < super :: EchoRequest > for ServerStreamingEchoServer < T > {
239
210
type Response = super :: EchoResponse ;
240
211
type ResponseStream = T :: ServerStreamingEchoStream ;
241
- type Future = BoxFuture <
242
- Response < Self :: ResponseStream > ,
243
- dubbo:: status:: Status ,
244
- > ;
245
- fn call (
246
- & mut self ,
247
- request : Request < super :: EchoRequest > ,
248
- ) -> Self :: Future {
212
+ type Future =
213
+ BoxFuture < Response < Self :: ResponseStream > , dubbo:: status:: Status > ;
214
+ fn call ( & mut self , request : Request < super :: EchoRequest > ) -> Self :: Future {
249
215
let inner = self . inner . 0 . clone ( ) ;
250
- let fut = async move {
251
- inner. server_streaming_echo ( request) . await
252
- } ;
216
+ let fut = async move { inner. server_streaming_echo ( request) . await } ;
253
217
Box :: pin ( fut)
254
218
}
255
219
}
256
220
let fut = async move {
257
- let mut server = TripleServer :: new (
258
- dubbo:: codegen:: ProstCodec :: <
259
- super :: EchoResponse ,
260
- super :: EchoRequest ,
261
- > :: default ( ) ,
262
- ) ;
221
+ let mut server = TripleServer :: new ( dubbo:: codegen:: ProstCodec :: <
222
+ super :: EchoResponse ,
223
+ super :: EchoRequest ,
224
+ > :: default ( ) ) ;
263
225
let res = server
264
226
. server_streaming ( ServerStreamingEchoServer { inner } , req)
265
227
. await ;
@@ -272,31 +234,23 @@ pub mod echo_server {
272
234
struct ClientStreamingEchoServer < T : Echo > {
273
235
inner : _Inner < T > ,
274
236
}
275
- impl < T : Echo > ClientStreamingSvc < super :: EchoRequest >
276
- for ClientStreamingEchoServer < T > {
237
+ impl < T : Echo > ClientStreamingSvc < super :: EchoRequest > for ClientStreamingEchoServer < T > {
277
238
type Response = super :: EchoResponse ;
278
- type Future = BoxFuture <
279
- Response < Self :: Response > ,
280
- dubbo:: status:: Status ,
281
- > ;
239
+ type Future = BoxFuture < Response < Self :: Response > , dubbo:: status:: Status > ;
282
240
fn call (
283
241
& mut self ,
284
242
request : Request < Decoding < super :: EchoRequest > > ,
285
243
) -> Self :: Future {
286
244
let inner = self . inner . 0 . clone ( ) ;
287
- let fut = async move {
288
- inner. client_streaming_echo ( request) . await
289
- } ;
245
+ let fut = async move { inner. client_streaming_echo ( request) . await } ;
290
246
Box :: pin ( fut)
291
247
}
292
248
}
293
249
let fut = async move {
294
- let mut server = TripleServer :: new (
295
- dubbo:: codegen:: ProstCodec :: <
296
- super :: EchoResponse ,
297
- super :: EchoRequest ,
298
- > :: default ( ) ,
299
- ) ;
250
+ let mut server = TripleServer :: new ( dubbo:: codegen:: ProstCodec :: <
251
+ super :: EchoResponse ,
252
+ super :: EchoRequest ,
253
+ > :: default ( ) ) ;
300
254
let res = server
301
255
. client_streaming ( ClientStreamingEchoServer { inner } , req)
302
256
. await ;
@@ -309,56 +263,41 @@ pub mod echo_server {
309
263
struct BidirectionalStreamingEchoServer < T : Echo > {
310
264
inner : _Inner < T > ,
311
265
}
312
- impl < T : Echo > StreamingSvc < super :: EchoRequest >
313
- for BidirectionalStreamingEchoServer < T > {
266
+ impl < T : Echo > StreamingSvc < super :: EchoRequest > for BidirectionalStreamingEchoServer < T > {
314
267
type Response = super :: EchoResponse ;
315
268
type ResponseStream = T :: BidirectionalStreamingEchoStream ;
316
- type Future = BoxFuture <
317
- Response < Self :: ResponseStream > ,
318
- dubbo:: status:: Status ,
319
- > ;
269
+ type Future =
270
+ BoxFuture < Response < Self :: ResponseStream > , dubbo:: status:: Status > ;
320
271
fn call (
321
272
& mut self ,
322
273
request : Request < Decoding < super :: EchoRequest > > ,
323
274
) -> Self :: Future {
324
275
let inner = self . inner . 0 . clone ( ) ;
325
- let fut = async move {
326
- inner. bidirectional_streaming_echo ( request) . await
327
- } ;
276
+ let fut =
277
+ async move { inner. bidirectional_streaming_echo ( request) . await } ;
328
278
Box :: pin ( fut)
329
279
}
330
280
}
331
281
let fut = async move {
332
- let mut server = TripleServer :: new (
333
- dubbo:: codegen:: ProstCodec :: <
334
- super :: EchoResponse ,
335
- super :: EchoRequest ,
336
- > :: default ( ) ,
337
- ) ;
282
+ let mut server = TripleServer :: new ( dubbo:: codegen:: ProstCodec :: <
283
+ super :: EchoResponse ,
284
+ super :: EchoRequest ,
285
+ > :: default ( ) ) ;
338
286
let res = server
339
- . bidi_streaming (
340
- BidirectionalStreamingEchoServer {
341
- inner,
342
- } ,
343
- req,
344
- )
287
+ . bidi_streaming ( BidirectionalStreamingEchoServer { inner } , req)
345
288
. await ;
346
289
Ok ( res)
347
290
} ;
348
291
Box :: pin ( fut)
349
292
}
350
- _ => {
351
- Box :: pin ( async move {
352
- Ok (
353
- http:: Response :: builder ( )
354
- . status ( 200 )
355
- . header ( "grpc-status" , "12" )
356
- . header ( "content-type" , "application/grpc" )
357
- . body ( empty_body ( ) )
358
- . unwrap ( ) ,
359
- )
360
- } )
361
- }
293
+ _ => Box :: pin ( async move {
294
+ Ok ( http:: Response :: builder ( )
295
+ . status ( 200 )
296
+ . header ( "grpc-status" , "12" )
297
+ . header ( "content-type" , "application/grpc" )
298
+ . body ( empty_body ( ) )
299
+ . unwrap ( ) )
300
+ } ) ,
362
301
}
363
302
}
364
303
}
0 commit comments