@@ -330,88 +330,33 @@ impl Displayable for Directive {
330
330
}
331
331
}
332
332
333
- impl fmt:: Display for Document {
334
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
335
- f. write_str ( & to_string ( self ) )
336
- }
337
- }
338
- impl fmt:: Display for Definition {
339
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
340
- f. write_str ( & to_string ( self ) )
341
- }
342
- }
343
- impl fmt:: Display for OperationDefinition {
344
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
345
- f. write_str ( & to_string ( self ) )
346
- }
347
- }
348
- impl fmt:: Display for FragmentDefinition {
349
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
350
- f. write_str ( & to_string ( self ) )
351
- }
352
- }
353
- impl fmt:: Display for SelectionSet {
354
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
355
- f. write_str ( & to_string ( self ) )
356
- }
357
- }
358
- impl fmt:: Display for Selection {
359
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
360
- f. write_str ( & to_string ( self ) )
361
- }
362
- }
363
- impl fmt:: Display for Field {
364
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
365
- f. write_str ( & to_string ( self ) )
366
- }
367
- }
368
- impl fmt:: Display for Query {
369
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
370
- f. write_str ( & to_string ( self ) )
371
- }
372
- }
373
- impl fmt:: Display for Mutation {
374
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
375
- f. write_str ( & to_string ( self ) )
376
- }
377
- }
378
- impl fmt:: Display for Subscription {
379
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
380
- f. write_str ( & to_string ( self ) )
381
- }
382
- }
383
- impl fmt:: Display for VariableDefinition {
384
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
385
- f. write_str ( & to_string ( self ) )
386
- }
387
- }
388
- impl fmt:: Display for VariableType {
389
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
390
- f. write_str ( & to_string ( self ) )
391
- }
392
- }
393
- impl fmt:: Display for Value {
394
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
395
- f. write_str ( & to_string ( self ) )
396
- }
397
- }
398
- impl fmt:: Display for InlineFragment {
399
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
400
- f. write_str ( & to_string ( self ) )
401
- }
402
- }
403
- impl fmt:: Display for TypeCondition {
404
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
405
- f. write_str ( & to_string ( self ) )
406
- }
407
- }
408
- impl fmt:: Display for FragmentSpread {
409
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
410
- f. write_str ( & to_string ( self ) )
411
- }
412
- }
413
- impl fmt:: Display for Directive {
414
- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
415
- f. write_str ( & to_string ( self ) )
416
- }
417
- }
333
+ macro_rules! impl_display {
334
+ ( $( $typ: ident ) ,+) => {
335
+ $(
336
+ impl fmt:: Display for $typ {
337
+ fn fmt( & self , f: & mut fmt:: Formatter ) -> fmt:: Result {
338
+ f. write_str( & to_string( self ) )
339
+ }
340
+ }
341
+ ) +
342
+ } ;
343
+ }
344
+ impl_display ! (
345
+ Document ,
346
+ Definition ,
347
+ OperationDefinition ,
348
+ FragmentDefinition ,
349
+ SelectionSet ,
350
+ Field ,
351
+ Query ,
352
+ Mutation ,
353
+ Subscription ,
354
+ VariableDefinition ,
355
+ VariableType ,
356
+ Value ,
357
+ InlineFragment ,
358
+ TypeCondition ,
359
+ FragmentSpread ,
360
+ Directive
361
+ ) ;
362
+
0 commit comments