Implements Debug for SelectionField. #364
This commit is contained in:
parent
e13d1a3f03
commit
6b540c3845
|
@ -623,6 +623,7 @@ impl<'a> ContextBase<'a, &'a Positioned<Field>> {
|
|||
}
|
||||
|
||||
/// Selection field.
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct SelectionField<'a> {
|
||||
fragments: &'a HashMap<Name, Positioned<FragmentDefinition>>,
|
||||
field: &'a Field,
|
||||
|
@ -643,6 +644,26 @@ impl<'a> SelectionField<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
struct DebugSelectionSet<'a>(Vec<SelectionField<'a>>);
|
||||
|
||||
impl<'a> Debug for DebugSelectionSet<'a> {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_list().entries(self.0.clone()).finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Debug for SelectionField<'a> {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct(self.name())
|
||||
.field("name", &self.name())
|
||||
.field(
|
||||
"selection_set",
|
||||
&DebugSelectionSet(self.selection_set().collect()),
|
||||
)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
struct SelectionFieldsIter<'a> {
|
||||
fragments: &'a HashMap<Name, Positioned<FragmentDefinition>>,
|
||||
iter: Vec<std::slice::Iter<'a, Positioned<Selection>>>,
|
||||
|
|
Loading…
Reference in New Issue
Block a user