Skip to content

Commit c56b068

Browse files
authored
Add owned impl IntoIterator for DirectiveList (#826)
Fixes #821
1 parent f6e86b9 commit c56b068

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

crates/apollo-compiler/src/ast/impls.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,16 @@ impl std::ops::DerefMut for DirectiveList {
596596
}
597597
}
598598

599+
impl IntoIterator for DirectiveList {
600+
type Item = Node<Directive>;
601+
602+
type IntoIter = std::vec::IntoIter<Node<Directive>>;
603+
604+
fn into_iter(self) -> Self::IntoIter {
605+
self.0.into_iter()
606+
}
607+
}
608+
599609
impl<'a> IntoIterator for &'a DirectiveList {
600610
type Item = &'a Node<Directive>;
601611

crates/apollo-compiler/src/schema/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,16 @@ impl std::ops::DerefMut for DirectiveList {
867867
}
868868
}
869869

870+
impl IntoIterator for DirectiveList {
871+
type Item = Component<Directive>;
872+
873+
type IntoIter = std::vec::IntoIter<Component<Directive>>;
874+
875+
fn into_iter(self) -> Self::IntoIter {
876+
self.0.into_iter()
877+
}
878+
}
879+
870880
impl<'a> IntoIterator for &'a DirectiveList {
871881
type Item = &'a Component<Directive>;
872882

0 commit comments

Comments
 (0)