@@ -22,7 +22,10 @@ use crate::schema::ast::ObjectType;
2222#[ derive( Debug , Clone , PartialEq ) ]
2323pub struct SelectionSet {
2424 // 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
2629 items : Vec < ( ObjectType , Vec < Field > ) > ,
2730}
2831
@@ -96,6 +99,10 @@ impl SelectionSet {
9699 }
97100
98101 /// 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
99106 pub fn fields_for ( & self , obj_type : & ObjectType ) -> impl Iterator < Item = & Field > {
100107 let item = self
101108 . items
@@ -254,7 +261,7 @@ impl ValueMap for Field {
254261
255262/// A set of object types, generated from resolving interfaces into the
256263/// object types that implement them, and possibly narrowing further when
257- /// expanding fragments with type conitions
264+ /// expanding fragments with type conditions
258265#[ derive( Debug , Clone , PartialEq ) ]
259266pub ( crate ) enum ObjectTypeSet {
260267 Any ,
0 commit comments