1
Fork 0

Add IntoIterator impl for [T; N] (arrays by value)

This commit is contained in:
Lukas Kalbertodt 2019-10-25 17:25:58 +02:00 committed by Josh Stone
parent b79af2fcde
commit 32aaea9c8f

View file

@ -155,6 +155,16 @@ impl<T: fmt::Debug, const N: usize> fmt::Debug for [T; N] {
}
}
#[stable(feature = "array_into_iter_impl", since = "1.53.0")]
impl<T, const N: usize> IntoIterator for [T; N] {
type Item = T;
type IntoIter = IntoIter<T, N>;
fn into_iter(self) -> Self::IntoIter {
IntoIter::new(self)
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T, const N: usize> IntoIterator for &'a [T; N] {
type Item = &'a T;