Add IntoIterator
impl for [T; N]
(arrays by value)
This commit is contained in:
parent
b79af2fcde
commit
32aaea9c8f
1 changed files with 10 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue