@@ -8,10 +8,12 @@ use crate::position::Pos;
8
8
9
9
#[ derive( Debug , Clone , Default , PartialEq ) ]
10
10
#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
11
+ #[ cfg_attr( feature = "serde" , serde( bound( deserialize="'a: 'de, T: Deserialize<'de>" ) ) ) ]
11
12
pub struct Document < ' a , T : Text < ' a > >
12
13
where
13
14
T : Text < ' a > ,
14
15
{
16
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
15
17
pub definitions : Vec < Definition < ' a , T > > ,
16
18
}
17
19
@@ -36,17 +38,24 @@ impl<'a> Document<'a, String> {
36
38
37
39
#[ derive( Debug , Clone , PartialEq ) ]
38
40
#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
41
+ #[ cfg_attr( feature = "serde" , serde( bound( deserialize="'a: 'de, T: Deserialize<'de>" ) ) ) ]
39
42
pub enum Definition < ' a , T : Text < ' a > > {
43
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
40
44
SchemaDefinition ( SchemaDefinition < ' a , T > ) ,
45
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
41
46
TypeDefinition ( TypeDefinition < ' a , T > ) ,
47
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
42
48
TypeExtension ( TypeExtension < ' a , T > ) ,
49
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
43
50
DirectiveDefinition ( DirectiveDefinition < ' a , T > ) ,
44
51
}
45
52
46
53
#[ derive( Debug , Clone , Default , PartialEq ) ]
47
54
#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
55
+ #[ cfg_attr( feature = "serde" , serde( bound( deserialize="'a: 'de, T: Deserialize<'de>" ) ) ) ]
48
56
pub struct SchemaDefinition < ' a , T : Text < ' a > > {
49
57
pub position : Pos ,
58
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
50
59
pub directives : Vec < Directive < ' a , T > > ,
51
60
pub query : Option < T :: Value > ,
52
61
pub mutation : Option < T :: Value > ,
@@ -55,23 +64,37 @@ pub struct SchemaDefinition<'a, T: Text<'a>> {
55
64
56
65
#[ derive( Debug , Clone , PartialEq ) ]
57
66
#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
67
+ #[ cfg_attr( feature = "serde" , serde( bound( deserialize="'a: 'de, T: Deserialize<'de>" ) ) ) ]
58
68
pub enum TypeDefinition < ' a , T : Text < ' a > > {
69
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
59
70
Scalar ( ScalarType < ' a , T > ) ,
71
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
60
72
Object ( ObjectType < ' a , T > ) ,
73
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
61
74
Interface ( InterfaceType < ' a , T > ) ,
75
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
62
76
Union ( UnionType < ' a , T > ) ,
77
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
63
78
Enum ( EnumType < ' a , T > ) ,
79
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
64
80
InputObject ( InputObjectType < ' a , T > ) ,
65
81
}
66
82
67
83
#[ derive( Debug , Clone , PartialEq ) ]
68
84
#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
85
+ #[ cfg_attr( feature = "serde" , serde( bound( deserialize="'a: 'de, T: Deserialize<'de>" ) ) ) ]
69
86
pub enum TypeExtension < ' a , T : Text < ' a > > {
87
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
70
88
Scalar ( ScalarTypeExtension < ' a , T > ) ,
89
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
71
90
Object ( ObjectTypeExtension < ' a , T > ) ,
91
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
72
92
Interface ( InterfaceTypeExtension < ' a , T > ) ,
93
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
73
94
Union ( UnionTypeExtension < ' a , T > ) ,
95
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
74
96
Enum ( EnumTypeExtension < ' a , T > ) ,
97
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
75
98
InputObject ( InputObjectTypeExtension < ' a , T > ) ,
76
99
}
77
100
@@ -81,6 +104,7 @@ pub struct ScalarType<'a, T: Text<'a>> {
81
104
pub position : Pos ,
82
105
pub description : Option < String > ,
83
106
pub name : T :: Value ,
107
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
84
108
pub directives : Vec < Directive < ' a , T > > ,
85
109
}
86
110
@@ -103,6 +127,7 @@ where
103
127
pub struct ScalarTypeExtension < ' a , T : Text < ' a > > {
104
128
pub position : Pos ,
105
129
pub name : T :: Value ,
130
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
106
131
pub directives : Vec < Directive < ' a , T > > ,
107
132
}
108
133
@@ -126,7 +151,9 @@ pub struct ObjectType<'a, T: Text<'a>> {
126
151
pub description : Option < String > ,
127
152
pub name : T :: Value ,
128
153
pub implements_interfaces : Vec < T :: Value > ,
154
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
129
155
pub directives : Vec < Directive < ' a , T > > ,
156
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
130
157
pub fields : Vec < Field < ' a , T > > ,
131
158
}
132
159
@@ -152,7 +179,9 @@ pub struct ObjectTypeExtension<'a, T: Text<'a>> {
152
179
pub position : Pos ,
153
180
pub name : T :: Value ,
154
181
pub implements_interfaces : Vec < T :: Value > ,
182
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
155
183
pub directives : Vec < Directive < ' a , T > > ,
184
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
156
185
pub fields : Vec < Field < ' a , T > > ,
157
186
}
158
187
@@ -177,8 +206,11 @@ pub struct Field<'a, T: Text<'a>> {
177
206
pub position : Pos ,
178
207
pub description : Option < String > ,
179
208
pub name : T :: Value ,
209
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
180
210
pub arguments : Vec < InputValue < ' a , T > > ,
211
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
181
212
pub field_type : Type < ' a , T > ,
213
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
182
214
pub directives : Vec < Directive < ' a , T > > ,
183
215
}
184
216
@@ -188,8 +220,11 @@ pub struct InputValue<'a, T: Text<'a>> {
188
220
pub position : Pos ,
189
221
pub description : Option < String > ,
190
222
pub name : T :: Value ,
223
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
191
224
pub value_type : Type < ' a , T > ,
225
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
192
226
pub default_value : Option < Value < ' a , T > > ,
227
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
193
228
pub directives : Vec < Directive < ' a , T > > ,
194
229
}
195
230
@@ -200,7 +235,9 @@ pub struct InterfaceType<'a, T: Text<'a>> {
200
235
pub description : Option < String > ,
201
236
pub name : T :: Value ,
202
237
pub implements_interfaces : Vec < T :: Value > ,
238
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
203
239
pub directives : Vec < Directive < ' a , T > > ,
240
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
204
241
pub fields : Vec < Field < ' a , T > > ,
205
242
}
206
243
@@ -226,7 +263,9 @@ pub struct InterfaceTypeExtension<'a, T: Text<'a>> {
226
263
pub position : Pos ,
227
264
pub name : T :: Value ,
228
265
pub implements_interfaces : Vec < T :: Value > ,
266
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
229
267
pub directives : Vec < Directive < ' a , T > > ,
268
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
230
269
pub fields : Vec < Field < ' a , T > > ,
231
270
}
232
271
@@ -251,6 +290,7 @@ pub struct UnionType<'a, T: Text<'a>> {
251
290
pub position : Pos ,
252
291
pub description : Option < String > ,
253
292
pub name : T :: Value ,
293
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
254
294
pub directives : Vec < Directive < ' a , T > > ,
255
295
pub types : Vec < T :: Value > ,
256
296
}
@@ -275,6 +315,7 @@ where
275
315
pub struct UnionTypeExtension < ' a , T : Text < ' a > > {
276
316
pub position : Pos ,
277
317
pub name : T :: Value ,
318
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
278
319
pub directives : Vec < Directive < ' a , T > > ,
279
320
pub types : Vec < T :: Value > ,
280
321
}
@@ -299,7 +340,9 @@ pub struct EnumType<'a, T: Text<'a>> {
299
340
pub position : Pos ,
300
341
pub description : Option < String > ,
301
342
pub name : T :: Value ,
343
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
302
344
pub directives : Vec < Directive < ' a , T > > ,
345
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
303
346
pub values : Vec < EnumValue < ' a , T > > ,
304
347
}
305
348
@@ -324,6 +367,7 @@ pub struct EnumValue<'a, T: Text<'a>> {
324
367
pub position : Pos ,
325
368
pub description : Option < String > ,
326
369
pub name : T :: Value ,
370
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
327
371
pub directives : Vec < Directive < ' a , T > > ,
328
372
}
329
373
@@ -346,7 +390,9 @@ where
346
390
pub struct EnumTypeExtension < ' a , T : Text < ' a > > {
347
391
pub position : Pos ,
348
392
pub name : T :: Value ,
393
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
349
394
pub directives : Vec < Directive < ' a , T > > ,
395
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
350
396
pub values : Vec < EnumValue < ' a , T > > ,
351
397
}
352
398
@@ -370,7 +416,9 @@ pub struct InputObjectType<'a, T: Text<'a>> {
370
416
pub position : Pos ,
371
417
pub description : Option < String > ,
372
418
pub name : T :: Value ,
419
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
373
420
pub directives : Vec < Directive < ' a , T > > ,
421
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
374
422
pub fields : Vec < InputValue < ' a , T > > ,
375
423
}
376
424
@@ -394,7 +442,9 @@ where
394
442
pub struct InputObjectTypeExtension < ' a , T : Text < ' a > > {
395
443
pub position : Pos ,
396
444
pub name : T :: Value ,
445
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
397
446
pub directives : Vec < Directive < ' a , T > > ,
447
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
398
448
pub fields : Vec < InputValue < ' a , T > > ,
399
449
}
400
450
@@ -445,6 +495,7 @@ pub struct DirectiveDefinition<'a, T: Text<'a>> {
445
495
pub position : Pos ,
446
496
pub description : Option < String > ,
447
497
pub name : T :: Value ,
498
+ #[ cfg_attr( feature = "serde" , serde( borrow) ) ]
448
499
pub arguments : Vec < InputValue < ' a , T > > ,
449
500
pub repeatable : bool ,
450
501
pub locations : Vec < DirectiveLocation > ,
0 commit comments