@@ -22,7 +22,10 @@ use crate::schema::ast::ObjectType;
22
22
#[ derive( Debug , Clone , PartialEq ) ]
23
23
pub struct SelectionSet {
24
24
// Map object types to the list of fields that should be selected for
25
- // them
25
+ // them. In most cases, this will have a single entry. If the
26
+ // `SelectionSet` is attached to a field with an interface or union
27
+ // type, it will have an entry for each object type implementing that
28
+ // interface or being part of the union
26
29
items : Vec < ( ObjectType , Vec < Field > ) > ,
27
30
}
28
31
@@ -96,6 +99,10 @@ impl SelectionSet {
96
99
}
97
100
98
101
/// Iterate over all fields for the given object type
102
+ ///
103
+ /// # Panics
104
+ /// If this `SelectionSet` does not have an entry for `obj_type`, this
105
+ /// method will panic
99
106
pub fn fields_for ( & self , obj_type : & ObjectType ) -> impl Iterator < Item = & Field > {
100
107
let item = self
101
108
. items
@@ -254,7 +261,7 @@ impl ValueMap for Field {
254
261
255
262
/// A set of object types, generated from resolving interfaces into the
256
263
/// object types that implement them, and possibly narrowing further when
257
- /// expanding fragments with type conitions
264
+ /// expanding fragments with type conditions
258
265
#[ derive( Debug , Clone , PartialEq ) ]
259
266
pub ( crate ) enum ObjectTypeSet {
260
267
Any ,
0 commit comments