use super::element_iter::ElementIter;
use crate::application::array::Array;
use crate::application::view::{ArrayView, ArrayViewMut};
use crate::infrastructure::storage::Storage;
impl<'a, T, const N: usize> IntoIterator for &ArrayView<'a, T, N> {
type Item = &'a T;
type IntoIter = ElementIter<'a, T, N>;
#[inline]
fn into_iter(self) -> Self::IntoIter {
self.iter()
}
}
impl<'a, T, S, const N: usize> IntoIterator for &'a Array<T, S, N>
where
S: Storage<T>,
{
type Item = &'a T;
type IntoIter = ElementIter<'a, T, N>;
#[inline]
fn into_iter(self) -> Self::IntoIter {
self.view().iter()
}
}
impl<'a, T, const N: usize> IntoIterator for &'a ArrayViewMut<'_, T, N> {
type Item = &'a T;
type IntoIter = ElementIter<'a, T, N>;
#[inline]
fn into_iter(self) -> Self::IntoIter {
self.as_view().iter()
}
}