@@ -6,7 +6,7 @@ mod tests;
6
6
7
7
use crate :: query:: UsedTypes ;
8
8
use crate :: type_qualifiers:: GraphqlTypeQualifier ;
9
- use std:: collections:: { HashMap , HashSet } ;
9
+ use std:: collections:: { BTreeMap , BTreeSet } ;
10
10
11
11
pub ( crate ) const DEFAULT_SCALARS : & [ & str ] = & [ "ID" , "String" , "Int" , "Float" , "Boolean" ] ;
12
12
@@ -44,25 +44,25 @@ pub(crate) enum StoredFieldParent {
44
44
Interface ( InterfaceId ) ,
45
45
}
46
46
47
- #[ derive( Debug , Clone , Copy , PartialEq , Hash , Eq ) ]
47
+ #[ derive( Debug , Clone , Copy , PartialEq , Hash , Eq , PartialOrd , Ord ) ]
48
48
pub ( crate ) struct ObjectId ( u32 ) ;
49
49
50
50
#[ derive( Debug , Clone , Copy , PartialEq , Hash , Eq ) ]
51
51
pub ( crate ) struct ObjectFieldId ( usize ) ;
52
52
53
- #[ derive( Debug , Clone , Copy , PartialEq , Hash , Eq ) ]
53
+ #[ derive( Debug , Clone , Copy , PartialEq , Hash , Eq , PartialOrd , Ord ) ]
54
54
pub ( crate ) struct InterfaceId ( usize ) ;
55
55
56
- #[ derive( Debug , Clone , Copy , PartialEq , Hash , Eq ) ]
56
+ #[ derive( Debug , Clone , Copy , PartialEq , Hash , Eq , PartialOrd , Ord ) ]
57
57
pub ( crate ) struct ScalarId ( usize ) ;
58
58
59
- #[ derive( Debug , Clone , Copy , PartialEq , Hash , Eq ) ]
59
+ #[ derive( Debug , Clone , Copy , PartialEq , Hash , Eq , PartialOrd , Ord ) ]
60
60
pub ( crate ) struct UnionId ( usize ) ;
61
61
62
- #[ derive( Debug , Clone , Copy , PartialEq , Hash , Eq ) ]
62
+ #[ derive( Debug , Clone , Copy , PartialEq , Hash , Eq , PartialOrd , Ord ) ]
63
63
pub ( crate ) struct EnumId ( usize ) ;
64
64
65
- #[ derive( Debug , Clone , Copy , PartialEq , Hash , Eq ) ]
65
+ #[ derive( Debug , Clone , Copy , PartialEq , Hash , Eq , PartialOrd , Ord ) ]
66
66
pub ( crate ) struct InputId ( u32 ) ;
67
67
68
68
#[ derive( Debug , Clone , Copy , PartialEq ) ]
@@ -98,7 +98,7 @@ pub(crate) struct StoredScalar {
98
98
pub ( crate ) name : String ,
99
99
}
100
100
101
- #[ derive( Debug , Clone , Copy , PartialEq , Hash , Eq ) ]
101
+ #[ derive( Debug , Clone , Copy , PartialEq , Hash , Eq , PartialOrd , Ord ) ]
102
102
pub ( crate ) enum TypeId {
103
103
Object ( ObjectId ) ,
104
104
Scalar ( ScalarId ) ,
@@ -222,7 +222,7 @@ pub(crate) struct Schema {
222
222
stored_scalars : Vec < StoredScalar > ,
223
223
stored_enums : Vec < StoredEnum > ,
224
224
stored_inputs : Vec < StoredInputType > ,
225
- names : HashMap < String , TypeId > ,
225
+ names : BTreeMap < String , TypeId > ,
226
226
227
227
pub ( crate ) query_type : Option < ObjectId > ,
228
228
pub ( crate ) mutation_type : Option < ObjectId > ,
@@ -239,7 +239,7 @@ impl Schema {
239
239
stored_scalars : Vec :: with_capacity ( DEFAULT_SCALARS . len ( ) ) ,
240
240
stored_enums : Vec :: new ( ) ,
241
241
stored_inputs : Vec :: new ( ) ,
242
- names : HashMap :: new ( ) ,
242
+ names : BTreeMap :: new ( ) ,
243
243
query_type : None ,
244
244
mutation_type : None ,
245
245
subscription_type : None ,
@@ -404,7 +404,7 @@ impl StoredInputType {
404
404
& ' a self ,
405
405
input_id : InputId ,
406
406
schema : & ' a Schema ,
407
- visited_types : & mut HashSet < & ' a str > ,
407
+ visited_types : & mut BTreeSet < & ' a str > ,
408
408
) -> bool {
409
409
visited_types. insert ( & self . name ) ;
410
410
// The input type is recursive if any of its members contains it, without indirection
@@ -440,7 +440,7 @@ impl StoredInputType {
440
440
441
441
pub ( crate ) fn input_is_recursive_without_indirection ( input_id : InputId , schema : & Schema ) -> bool {
442
442
let input = schema. get_input ( input_id) ;
443
- let mut visited_types = HashSet :: < & str > :: new ( ) ;
443
+ let mut visited_types = BTreeSet :: < & str > :: new ( ) ;
444
444
input. contains_type_without_indirection ( input_id, schema, & mut visited_types)
445
445
}
446
446
impl < ' doc , T > std:: convert:: From < graphql_parser:: schema:: Document < ' doc , T > > for Schema
0 commit comments