Skip to content

Commit

Permalink
Add owned impl IntoIterator for DirectiveList
Browse files Browse the repository at this point in the history
Fixes #821
  • Loading branch information
SimonSapin committed Feb 8, 2024
1 parent 0fa07a8 commit 8ca0a80
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions crates/apollo-compiler/src/ast/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,16 @@ impl std::ops::DerefMut for DirectiveList {
}
}

impl<'a> IntoIterator for DirectiveList {
type Item = Node<Directive>;

type IntoIter = std::vec::IntoIter<Node<Directive>>;

fn into_iter(self) -> Self::IntoIter {
self.0.into_iter()
}
}

impl<'a> IntoIterator for &'a DirectiveList {
type Item = &'a Node<Directive>;

Expand Down
10 changes: 10 additions & 0 deletions crates/apollo-compiler/src/schema/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,16 @@ impl std::ops::DerefMut for DirectiveList {
}
}

impl IntoIterator for DirectiveList {
type Item = Component<Directive>;

type IntoIter = std::vec::IntoIter<Component<Directive>>;

fn into_iter(self) -> Self::IntoIter {
self.0.into_iter()
}
}

impl<'a> IntoIterator for &'a DirectiveList {
type Item = &'a Component<Directive>;

Expand Down

0 comments on commit 8ca0a80

Please sign in to comment.