11use std:: str:: FromStr ;
22
3+ use thiserror:: Error ;
4+
35pub use crate :: common:: { Directive , Type , Value , Text } ;
46use crate :: position:: Pos ;
57
68#[ derive( Debug , Clone , Default , PartialEq ) ]
7- pub struct Document < ' a , T : Text < ' a > >
9+ pub struct Document < ' a , T : Text < ' a > >
810 where T : Text < ' a >
911{
1012 pub definitions : Vec < Definition < ' a , T > > ,
@@ -55,7 +57,7 @@ pub struct ScalarType<'a, T: Text<'a>> {
5557 pub directives : Vec < Directive < ' a , T > > ,
5658}
5759
58- impl < ' a , T > ScalarType < ' a , T >
60+ impl < ' a , T > ScalarType < ' a , T >
5961 where T : Text < ' a >
6062{
6163 pub fn new ( name : T :: Value ) -> Self {
@@ -75,7 +77,7 @@ pub struct ScalarTypeExtension<'a, T: Text<'a>> {
7577 pub directives : Vec < Directive < ' a , T > > ,
7678}
7779
78- impl < ' a , T > ScalarTypeExtension < ' a , T >
80+ impl < ' a , T > ScalarTypeExtension < ' a , T >
7981 where T : Text < ' a >
8082{
8183 pub fn new ( name : T :: Value ) -> Self {
@@ -97,7 +99,7 @@ pub struct ObjectType<'a, T: Text<'a>> {
9799 pub fields : Vec < Field < ' a , T > > ,
98100}
99101
100- impl < ' a , T > ObjectType < ' a , T >
102+ impl < ' a , T > ObjectType < ' a , T >
101103 where T : Text < ' a >
102104{
103105 pub fn new ( name : T :: Value ) -> Self {
@@ -121,7 +123,7 @@ pub struct ObjectTypeExtension<'a, T: Text<'a>> {
121123 pub fields : Vec < Field < ' a , T > > ,
122124}
123125
124- impl < ' a , T > ObjectTypeExtension < ' a , T >
126+ impl < ' a , T > ObjectTypeExtension < ' a , T >
125127 where T : Text < ' a >
126128{
127129 pub fn new ( name : T :: Value ) -> Self {
@@ -164,7 +166,7 @@ pub struct InterfaceType<'a, T: Text<'a>> {
164166 pub fields : Vec < Field < ' a , T > > ,
165167}
166168
167- impl < ' a , T > InterfaceType < ' a , T >
169+ impl < ' a , T > InterfaceType < ' a , T >
168170 where T : Text < ' a >
169171{
170172 pub fn new ( name : T :: Value ) -> Self {
@@ -186,7 +188,7 @@ pub struct InterfaceTypeExtension<'a, T: Text<'a>> {
186188 pub fields : Vec < Field < ' a , T > > ,
187189}
188190
189- impl < ' a , T > InterfaceTypeExtension < ' a , T >
191+ impl < ' a , T > InterfaceTypeExtension < ' a , T >
190192where T : Text < ' a >
191193{
192194 pub fn new ( name : T :: Value ) -> Self {
@@ -208,7 +210,7 @@ pub struct UnionType<'a, T: Text<'a>> {
208210 pub types : Vec < T :: Value > ,
209211}
210212
211- impl < ' a , T > UnionType < ' a , T >
213+ impl < ' a , T > UnionType < ' a , T >
212214where T : Text < ' a >
213215{
214216 pub fn new ( name : T :: Value ) -> Self {
@@ -230,7 +232,7 @@ pub struct UnionTypeExtension<'a, T: Text<'a>> {
230232 pub types : Vec < T :: Value > ,
231233}
232234
233- impl < ' a , T > UnionTypeExtension < ' a , T >
235+ impl < ' a , T > UnionTypeExtension < ' a , T >
234236where T : Text < ' a >
235237{
236238 pub fn new ( name : T :: Value ) -> Self {
@@ -252,7 +254,7 @@ pub struct EnumType<'a, T: Text<'a>> {
252254 pub values : Vec < EnumValue < ' a , T > > ,
253255}
254256
255- impl < ' a , T > EnumType < ' a , T >
257+ impl < ' a , T > EnumType < ' a , T >
256258where T : Text < ' a >
257259{
258260 pub fn new ( name : T :: Value ) -> Self {
@@ -274,7 +276,7 @@ pub struct EnumValue<'a, T: Text<'a>> {
274276 pub directives : Vec < Directive < ' a , T > > ,
275277}
276278
277- impl < ' a , T > EnumValue < ' a , T >
279+ impl < ' a , T > EnumValue < ' a , T >
278280where T : Text < ' a >
279281{
280282 pub fn new ( name : T :: Value ) -> Self {
@@ -295,7 +297,7 @@ pub struct EnumTypeExtension<'a, T: Text<'a>> {
295297 pub values : Vec < EnumValue < ' a , T > > ,
296298}
297299
298- impl < ' a , T > EnumTypeExtension < ' a , T >
300+ impl < ' a , T > EnumTypeExtension < ' a , T >
299301where T : Text < ' a >
300302{
301303 pub fn new ( name : T :: Value ) -> Self {
@@ -317,7 +319,7 @@ pub struct InputObjectType<'a, T: Text<'a>> {
317319 pub fields : Vec < InputValue < ' a , T > > ,
318320}
319321
320- impl < ' a , T > InputObjectType < ' a , T >
322+ impl < ' a , T > InputObjectType < ' a , T >
321323where T : Text < ' a >
322324{
323325 pub fn new ( name : T :: Value ) -> Self {
@@ -339,7 +341,7 @@ pub struct InputObjectTypeExtension<'a, T: Text<'a>> {
339341 pub fields : Vec < InputValue < ' a , T > > ,
340342}
341343
342- impl < ' a , T > InputObjectTypeExtension < ' a , T >
344+ impl < ' a , T > InputObjectTypeExtension < ' a , T >
343345where T : Text < ' a >
344346{
345347 pub fn new ( name : T :: Value ) -> Self {
@@ -386,7 +388,7 @@ pub struct DirectiveDefinition<'a, T: Text<'a>> {
386388 pub locations : Vec < DirectiveLocation > ,
387389}
388390
389- impl < ' a , T > DirectiveDefinition < ' a , T >
391+ impl < ' a , T > DirectiveDefinition < ' a , T >
390392where T : Text < ' a >
391393{
392394 pub fn new ( name : T :: Value ) -> Self {
@@ -460,8 +462,8 @@ impl DirectiveLocation {
460462 }
461463}
462464
463- #[ derive( Debug , Fail ) ]
464- #[ fail ( display = "invalid directive location" ) ]
465+ #[ derive( Debug , Error ) ]
466+ #[ error ( "invalid directive location" ) ]
465467pub struct InvalidDirectiveLocation ;
466468
467469
0 commit comments