Skip to content

Commit f326adf

Browse files
Add IntoIterator impl for [T; N] (arrays by value)
1 parent cc41030 commit f326adf

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

library/core/src/array/mod.rs

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

194+
#[stable(feature = "array_into_iter_impl", since = "1.53.0")]
195+
impl<T, const N: usize> IntoIterator for [T; N] {
196+
type Item = T;
197+
type IntoIter = IntoIter<T, N>;
198+
199+
fn into_iter(self) -> Self::IntoIter {
200+
IntoIter::new(self)
201+
}
202+
}
203+
194204
#[stable(feature = "rust1", since = "1.0.0")]
195205
impl<'a, T, const N: usize> IntoIterator for &'a [T; N] {
196206
type Item = &'a T;

0 commit comments

Comments
 (0)