@@ -249,13 +249,12 @@ where
249
249
SubscriptionT : crate :: GraphQLType < S , Context = CtxT > ,
250
250
{
251
251
match * self {
252
- GraphQLBatchRequest :: Single ( ref request ) => {
253
- GraphQLBatchResponse :: Single ( request . execute_sync ( root_node, context) )
252
+ Self :: Single ( ref req ) => {
253
+ GraphQLBatchResponse :: Single ( req . execute_sync ( root_node, context) )
254
254
}
255
- GraphQLBatchRequest :: Batch ( ref requests) => GraphQLBatchResponse :: Batch (
256
- requests
257
- . iter ( )
258
- . map ( |request| request. execute_sync ( root_node, context) )
255
+ Self :: Batch ( ref reqs) => GraphQLBatchResponse :: Batch (
256
+ reqs. iter ( )
257
+ . map ( |req| req. execute_sync ( root_node, context) )
259
258
. collect ( ) ,
260
259
) ,
261
260
}
@@ -281,29 +280,25 @@ where
281
280
S : Send + Sync ,
282
281
{
283
282
match * self {
284
- GraphQLBatchRequest :: Single ( ref request ) => {
285
- let res = request . execute ( root_node, context) . await ;
286
- GraphQLBatchResponse :: Single ( res )
283
+ Self :: Single ( ref req ) => {
284
+ let resp = req . execute ( root_node, context) . await ;
285
+ GraphQLBatchResponse :: Single ( resp )
287
286
}
288
- GraphQLBatchRequest :: Batch ( ref requests) => {
289
- let futures = requests
290
- . iter ( )
291
- . map ( |request| request. execute ( root_node, context) )
292
- . collect :: < Vec < _ > > ( ) ;
293
- let responses = futures:: future:: join_all ( futures) . await ;
294
-
295
- GraphQLBatchResponse :: Batch ( responses)
287
+ Self :: Batch ( ref reqs) => {
288
+ let resps = futures:: future:: join_all (
289
+ reqs. iter ( ) . map ( |req| req. execute ( root_node, context) ) ,
290
+ )
291
+ . await ;
292
+ GraphQLBatchResponse :: Batch ( resps)
296
293
}
297
294
}
298
295
}
299
296
300
297
/// The operation names of the request.
301
298
pub fn operation_names ( & self ) -> Vec < Option < & str > > {
302
299
match self {
303
- GraphQLBatchRequest :: Single ( req) => vec ! [ req. operation_name( ) ] ,
304
- GraphQLBatchRequest :: Batch ( reqs) => {
305
- reqs. iter ( ) . map ( |req| req. operation_name ( ) ) . collect ( )
306
- }
300
+ Self :: Single ( req) => vec ! [ req. operation_name( ) ] ,
301
+ Self :: Batch ( reqs) => reqs. iter ( ) . map ( |req| req. operation_name ( ) ) . collect ( ) ,
307
302
}
308
303
}
309
304
}
@@ -333,8 +328,8 @@ where
333
328
/// you can use it to determine wheter to send a 200 or 400 HTTP status code.
334
329
pub fn is_ok ( & self ) -> bool {
335
330
match self {
336
- GraphQLBatchResponse :: Single ( res ) => res . is_ok ( ) ,
337
- GraphQLBatchResponse :: Batch ( reses ) => reses . iter ( ) . all ( |res| res . is_ok ( ) ) ,
331
+ Self :: Single ( resp ) => resp . is_ok ( ) ,
332
+ Self :: Batch ( resps ) => resps . iter ( ) . all ( GraphQLResponse :: is_ok) ,
338
333
}
339
334
}
340
335
}
0 commit comments