@@ -43,9 +43,7 @@ pub mod echo_client {
43
43
let invocation = RpcInvocation :: default ( )
44
44
. with_service_unique_name ( String :: from ( "grpc.examples.echo.Echo" ) )
45
45
. with_method_name ( String :: from ( "UnaryEcho" ) ) ;
46
- let path = http:: uri:: PathAndQuery :: from_static (
47
- "/grpc.examples.echo.Echo/UnaryEcho" ,
48
- ) ;
46
+ let path = http:: uri:: PathAndQuery :: from_static ( "/grpc.examples.echo.Echo/UnaryEcho" ) ;
49
47
self . inner . unary ( request, path, invocation) . await
50
48
}
51
49
/// ServerStreamingEcho is server side streaming.
@@ -102,9 +100,7 @@ pub mod echo_server {
102
100
request : Request < super :: EchoRequest > ,
103
101
) -> Result < Response < super :: EchoResponse > , dubbo:: status:: Status > ;
104
102
///Server streaming response type for the ServerStreamingEcho method.
105
- type ServerStreamingEchoStream : futures_util:: Stream <
106
- Item = Result < super :: EchoResponse , dubbo:: status:: Status > ,
107
- >
103
+ type ServerStreamingEchoStream : futures_util:: Stream < Item = Result < super :: EchoResponse , dubbo:: status:: Status > >
108
104
+ Send
109
105
+ ' static ;
110
106
/// ServerStreamingEcho is server side streaming.
@@ -118,19 +114,14 @@ pub mod echo_server {
118
114
request : Request < Decoding < super :: EchoRequest > > ,
119
115
) -> Result < Response < super :: EchoResponse > , dubbo:: status:: Status > ;
120
116
///Server streaming response type for the BidirectionalStreamingEcho method.
121
- type BidirectionalStreamingEchoStream : futures_util:: Stream <
122
- Item = Result < super :: EchoResponse , dubbo:: status:: Status > ,
123
- >
117
+ type BidirectionalStreamingEchoStream : futures_util:: Stream < Item = Result < super :: EchoResponse , dubbo:: status:: Status > >
124
118
+ Send
125
119
+ ' static ;
126
120
/// BidirectionalStreamingEcho is bidi streaming.
127
121
async fn bidirectional_streaming_echo (
128
122
& self ,
129
123
request : Request < Decoding < super :: EchoRequest > > ,
130
- ) -> Result <
131
- Response < Self :: BidirectionalStreamingEchoStream > ,
132
- dubbo:: status:: Status ,
133
- > ;
124
+ ) -> Result < Response < Self :: BidirectionalStreamingEchoStream > , dubbo:: status:: Status > ;
134
125
}
135
126
/// Echo is the echo service.
136
127
#[ derive( Debug ) ]
@@ -160,10 +151,7 @@ pub mod echo_server {
160
151
type Response = http:: Response < BoxBody > ;
161
152
type Error = std:: convert:: Infallible ;
162
153
type Future = BoxFuture < Self :: Response , Self :: Error > ;
163
- fn poll_ready (
164
- & mut self ,
165
- _cx : & mut Context < ' _ > ,
166
- ) -> Poll < Result < ( ) , Self :: Error > > {
154
+ fn poll_ready ( & mut self , _cx : & mut Context < ' _ > ) -> Poll < Result < ( ) , Self :: Error > > {
167
155
Poll :: Ready ( Ok ( ( ) ) )
168
156
}
169
157
fn call ( & mut self , req : http:: Request < B > ) -> Self :: Future {
@@ -176,24 +164,16 @@ pub mod echo_server {
176
164
}
177
165
impl < T : Echo > UnarySvc < super :: EchoRequest > for UnaryEchoServer < T > {
178
166
type Response = super :: EchoResponse ;
179
- type Future = BoxFuture <
180
- Response < Self :: Response > ,
181
- dubbo:: status:: Status ,
182
- > ;
183
- fn call (
184
- & mut self ,
185
- request : Request < super :: EchoRequest > ,
186
- ) -> Self :: Future {
167
+ type Future = BoxFuture < Response < Self :: Response > , dubbo:: status:: Status > ;
168
+ fn call ( & mut self , request : Request < super :: EchoRequest > ) -> Self :: Future {
187
169
let inner = self . inner . 0 . clone ( ) ;
188
170
let fut = async move { inner. unary_echo ( request) . await } ;
189
171
Box :: pin ( fut)
190
172
}
191
173
}
192
174
let fut = async move {
193
- let mut server = TripleServer :: <
194
- super :: EchoRequest ,
195
- super :: EchoResponse ,
196
- > :: new ( ) ;
175
+ let mut server =
176
+ TripleServer :: < super :: EchoRequest , super :: EchoResponse > :: new ( ) ;
197
177
let res = server. unary ( UnaryEchoServer { inner } , req) . await ;
198
178
Ok ( res)
199
179
} ;
@@ -204,30 +184,20 @@ pub mod echo_server {
204
184
struct ServerStreamingEchoServer < T : Echo > {
205
185
inner : _Inner < T > ,
206
186
}
207
- impl < T : Echo > ServerStreamingSvc < super :: EchoRequest >
208
- for ServerStreamingEchoServer < T > {
187
+ impl < T : Echo > ServerStreamingSvc < super :: EchoRequest > for ServerStreamingEchoServer < T > {
209
188
type Response = super :: EchoResponse ;
210
189
type ResponseStream = T :: ServerStreamingEchoStream ;
211
- type Future = BoxFuture <
212
- Response < Self :: ResponseStream > ,
213
- dubbo:: status:: Status ,
214
- > ;
215
- fn call (
216
- & mut self ,
217
- request : Request < super :: EchoRequest > ,
218
- ) -> Self :: Future {
190
+ type Future =
191
+ BoxFuture < Response < Self :: ResponseStream > , dubbo:: status:: Status > ;
192
+ fn call ( & mut self , request : Request < super :: EchoRequest > ) -> Self :: Future {
219
193
let inner = self . inner . 0 . clone ( ) ;
220
- let fut = async move {
221
- inner. server_streaming_echo ( request) . await
222
- } ;
194
+ let fut = async move { inner. server_streaming_echo ( request) . await } ;
223
195
Box :: pin ( fut)
224
196
}
225
197
}
226
198
let fut = async move {
227
- let mut server = TripleServer :: <
228
- super :: EchoRequest ,
229
- super :: EchoResponse ,
230
- > :: new ( ) ;
199
+ let mut server =
200
+ TripleServer :: < super :: EchoRequest , super :: EchoResponse > :: new ( ) ;
231
201
let res = server
232
202
. server_streaming ( ServerStreamingEchoServer { inner } , req)
233
203
. await ;
@@ -240,29 +210,21 @@ pub mod echo_server {
240
210
struct ClientStreamingEchoServer < T : Echo > {
241
211
inner : _Inner < T > ,
242
212
}
243
- impl < T : Echo > ClientStreamingSvc < super :: EchoRequest >
244
- for ClientStreamingEchoServer < T > {
213
+ impl < T : Echo > ClientStreamingSvc < super :: EchoRequest > for ClientStreamingEchoServer < T > {
245
214
type Response = super :: EchoResponse ;
246
- type Future = BoxFuture <
247
- Response < Self :: Response > ,
248
- dubbo:: status:: Status ,
249
- > ;
215
+ type Future = BoxFuture < Response < Self :: Response > , dubbo:: status:: Status > ;
250
216
fn call (
251
217
& mut self ,
252
218
request : Request < Decoding < super :: EchoRequest > > ,
253
219
) -> Self :: Future {
254
220
let inner = self . inner . 0 . clone ( ) ;
255
- let fut = async move {
256
- inner. client_streaming_echo ( request) . await
257
- } ;
221
+ let fut = async move { inner. client_streaming_echo ( request) . await } ;
258
222
Box :: pin ( fut)
259
223
}
260
224
}
261
225
let fut = async move {
262
- let mut server = TripleServer :: <
263
- super :: EchoRequest ,
264
- super :: EchoResponse ,
265
- > :: new ( ) ;
226
+ let mut server =
227
+ TripleServer :: < super :: EchoRequest , super :: EchoResponse > :: new ( ) ;
266
228
let res = server
267
229
. client_streaming ( ClientStreamingEchoServer { inner } , req)
268
230
. await ;
@@ -275,54 +237,39 @@ pub mod echo_server {
275
237
struct BidirectionalStreamingEchoServer < T : Echo > {
276
238
inner : _Inner < T > ,
277
239
}
278
- impl < T : Echo > StreamingSvc < super :: EchoRequest >
279
- for BidirectionalStreamingEchoServer < T > {
240
+ impl < T : Echo > StreamingSvc < super :: EchoRequest > for BidirectionalStreamingEchoServer < T > {
280
241
type Response = super :: EchoResponse ;
281
242
type ResponseStream = T :: BidirectionalStreamingEchoStream ;
282
- type Future = BoxFuture <
283
- Response < Self :: ResponseStream > ,
284
- dubbo:: status:: Status ,
285
- > ;
243
+ type Future =
244
+ BoxFuture < Response < Self :: ResponseStream > , dubbo:: status:: Status > ;
286
245
fn call (
287
246
& mut self ,
288
247
request : Request < Decoding < super :: EchoRequest > > ,
289
248
) -> Self :: Future {
290
249
let inner = self . inner . 0 . clone ( ) ;
291
- let fut = async move {
292
- inner. bidirectional_streaming_echo ( request) . await
293
- } ;
250
+ let fut =
251
+ async move { inner. bidirectional_streaming_echo ( request) . await } ;
294
252
Box :: pin ( fut)
295
253
}
296
254
}
297
255
let fut = async move {
298
- let mut server = TripleServer :: <
299
- super :: EchoRequest ,
300
- super :: EchoResponse ,
301
- > :: new ( ) ;
256
+ let mut server =
257
+ TripleServer :: < super :: EchoRequest , super :: EchoResponse > :: new ( ) ;
302
258
let res = server
303
- . bidi_streaming (
304
- BidirectionalStreamingEchoServer {
305
- inner,
306
- } ,
307
- req,
308
- )
259
+ . bidi_streaming ( BidirectionalStreamingEchoServer { inner } , req)
309
260
. await ;
310
261
Ok ( res)
311
262
} ;
312
263
Box :: pin ( fut)
313
264
}
314
- _ => {
315
- Box :: pin ( async move {
316
- Ok (
317
- http:: Response :: builder ( )
318
- . status ( 200 )
319
- . header ( "grpc-status" , "12" )
320
- . header ( "content-type" , "application/grpc" )
321
- . body ( empty_body ( ) )
322
- . unwrap ( ) ,
323
- )
324
- } )
325
- }
265
+ _ => Box :: pin ( async move {
266
+ Ok ( http:: Response :: builder ( )
267
+ . status ( 200 )
268
+ . header ( "grpc-status" , "12" )
269
+ . header ( "content-type" , "application/grpc" )
270
+ . body ( empty_body ( ) )
271
+ . unwrap ( ) )
272
+ } ) ,
326
273
}
327
274
}
328
275
}
0 commit comments