Add IntoIterator impl for [T; N] (arrays by value)
This commit is contained in:
committed by
Josh Stone
parent
b79af2fcde
commit
32aaea9c8f
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user