1
1
use std:: str:: FromStr ;
2
2
3
+ use thiserror:: Error ;
4
+
3
5
pub use crate :: common:: { Directive , Type , Value , Text } ;
4
6
use crate :: position:: Pos ;
5
7
6
8
#[ derive( Debug , Clone , Default , PartialEq ) ]
7
- pub struct Document < ' a , T : Text < ' a > >
9
+ pub struct Document < ' a , T : Text < ' a > >
8
10
where T : Text < ' a >
9
11
{
10
12
pub definitions : Vec < Definition < ' a , T > > ,
@@ -55,7 +57,7 @@ pub struct ScalarType<'a, T: Text<'a>> {
55
57
pub directives : Vec < Directive < ' a , T > > ,
56
58
}
57
59
58
- impl < ' a , T > ScalarType < ' a , T >
60
+ impl < ' a , T > ScalarType < ' a , T >
59
61
where T : Text < ' a >
60
62
{
61
63
pub fn new ( name : T :: Value ) -> Self {
@@ -75,7 +77,7 @@ pub struct ScalarTypeExtension<'a, T: Text<'a>> {
75
77
pub directives : Vec < Directive < ' a , T > > ,
76
78
}
77
79
78
- impl < ' a , T > ScalarTypeExtension < ' a , T >
80
+ impl < ' a , T > ScalarTypeExtension < ' a , T >
79
81
where T : Text < ' a >
80
82
{
81
83
pub fn new ( name : T :: Value ) -> Self {
@@ -97,7 +99,7 @@ pub struct ObjectType<'a, T: Text<'a>> {
97
99
pub fields : Vec < Field < ' a , T > > ,
98
100
}
99
101
100
- impl < ' a , T > ObjectType < ' a , T >
102
+ impl < ' a , T > ObjectType < ' a , T >
101
103
where T : Text < ' a >
102
104
{
103
105
pub fn new ( name : T :: Value ) -> Self {
@@ -121,7 +123,7 @@ pub struct ObjectTypeExtension<'a, T: Text<'a>> {
121
123
pub fields : Vec < Field < ' a , T > > ,
122
124
}
123
125
124
- impl < ' a , T > ObjectTypeExtension < ' a , T >
126
+ impl < ' a , T > ObjectTypeExtension < ' a , T >
125
127
where T : Text < ' a >
126
128
{
127
129
pub fn new ( name : T :: Value ) -> Self {
@@ -164,7 +166,7 @@ pub struct InterfaceType<'a, T: Text<'a>> {
164
166
pub fields : Vec < Field < ' a , T > > ,
165
167
}
166
168
167
- impl < ' a , T > InterfaceType < ' a , T >
169
+ impl < ' a , T > InterfaceType < ' a , T >
168
170
where T : Text < ' a >
169
171
{
170
172
pub fn new ( name : T :: Value ) -> Self {
@@ -186,7 +188,7 @@ pub struct InterfaceTypeExtension<'a, T: Text<'a>> {
186
188
pub fields : Vec < Field < ' a , T > > ,
187
189
}
188
190
189
- impl < ' a , T > InterfaceTypeExtension < ' a , T >
191
+ impl < ' a , T > InterfaceTypeExtension < ' a , T >
190
192
where T : Text < ' a >
191
193
{
192
194
pub fn new ( name : T :: Value ) -> Self {
@@ -208,7 +210,7 @@ pub struct UnionType<'a, T: Text<'a>> {
208
210
pub types : Vec < T :: Value > ,
209
211
}
210
212
211
- impl < ' a , T > UnionType < ' a , T >
213
+ impl < ' a , T > UnionType < ' a , T >
212
214
where T : Text < ' a >
213
215
{
214
216
pub fn new ( name : T :: Value ) -> Self {
@@ -230,7 +232,7 @@ pub struct UnionTypeExtension<'a, T: Text<'a>> {
230
232
pub types : Vec < T :: Value > ,
231
233
}
232
234
233
- impl < ' a , T > UnionTypeExtension < ' a , T >
235
+ impl < ' a , T > UnionTypeExtension < ' a , T >
234
236
where T : Text < ' a >
235
237
{
236
238
pub fn new ( name : T :: Value ) -> Self {
@@ -252,7 +254,7 @@ pub struct EnumType<'a, T: Text<'a>> {
252
254
pub values : Vec < EnumValue < ' a , T > > ,
253
255
}
254
256
255
- impl < ' a , T > EnumType < ' a , T >
257
+ impl < ' a , T > EnumType < ' a , T >
256
258
where T : Text < ' a >
257
259
{
258
260
pub fn new ( name : T :: Value ) -> Self {
@@ -274,7 +276,7 @@ pub struct EnumValue<'a, T: Text<'a>> {
274
276
pub directives : Vec < Directive < ' a , T > > ,
275
277
}
276
278
277
- impl < ' a , T > EnumValue < ' a , T >
279
+ impl < ' a , T > EnumValue < ' a , T >
278
280
where T : Text < ' a >
279
281
{
280
282
pub fn new ( name : T :: Value ) -> Self {
@@ -295,7 +297,7 @@ pub struct EnumTypeExtension<'a, T: Text<'a>> {
295
297
pub values : Vec < EnumValue < ' a , T > > ,
296
298
}
297
299
298
- impl < ' a , T > EnumTypeExtension < ' a , T >
300
+ impl < ' a , T > EnumTypeExtension < ' a , T >
299
301
where T : Text < ' a >
300
302
{
301
303
pub fn new ( name : T :: Value ) -> Self {
@@ -317,7 +319,7 @@ pub struct InputObjectType<'a, T: Text<'a>> {
317
319
pub fields : Vec < InputValue < ' a , T > > ,
318
320
}
319
321
320
- impl < ' a , T > InputObjectType < ' a , T >
322
+ impl < ' a , T > InputObjectType < ' a , T >
321
323
where T : Text < ' a >
322
324
{
323
325
pub fn new ( name : T :: Value ) -> Self {
@@ -339,7 +341,7 @@ pub struct InputObjectTypeExtension<'a, T: Text<'a>> {
339
341
pub fields : Vec < InputValue < ' a , T > > ,
340
342
}
341
343
342
- impl < ' a , T > InputObjectTypeExtension < ' a , T >
344
+ impl < ' a , T > InputObjectTypeExtension < ' a , T >
343
345
where T : Text < ' a >
344
346
{
345
347
pub fn new ( name : T :: Value ) -> Self {
@@ -386,7 +388,7 @@ pub struct DirectiveDefinition<'a, T: Text<'a>> {
386
388
pub locations : Vec < DirectiveLocation > ,
387
389
}
388
390
389
- impl < ' a , T > DirectiveDefinition < ' a , T >
391
+ impl < ' a , T > DirectiveDefinition < ' a , T >
390
392
where T : Text < ' a >
391
393
{
392
394
pub fn new ( name : T :: Value ) -> Self {
@@ -460,8 +462,8 @@ impl DirectiveLocation {
460
462
}
461
463
}
462
464
463
- #[ derive( Debug , Fail ) ]
464
- #[ fail ( display = "invalid directive location" ) ]
465
+ #[ derive( Debug , Error ) ]
466
+ #[ error ( "invalid directive location" ) ]
465
467
pub struct InvalidDirectiveLocation ;
466
468
467
469
0 commit comments