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