Skip to content

Commit 6df7420

Browse files
LukasKalbertodtcuviper
authored andcommitted
Add IntoIterator impl for [T; N] (arrays by value)
1 parent f1a1471 commit 6df7420

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

core/src/array/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,16 @@ impl<T: fmt::Debug, const N: usize> fmt::Debug for [T; N] {
155155
}
156156
}
157157

158+
#[stable(feature = "array_into_iter_impl", since = "1.53.0")]
159+
impl<T, const N: usize> IntoIterator for [T; N] {
160+
type Item = T;
161+
type IntoIter = IntoIter<T, N>;
162+
163+
fn into_iter(self) -> Self::IntoIter {
164+
IntoIter::new(self)
165+
}
166+
}
167+
158168
#[stable(feature = "rust1", since = "1.0.0")]
159169
impl<'a, T, const N: usize> IntoIterator for &'a [T; N] {
160170
type Item = &'a T;

0 commit comments

Comments
 (0)