pub trait IntoIter {
type IntoIter: Iterator;
type IntoParIter;
fn iter(self) -> Self::IntoIter;
fn iter_by<D: 'static>(self) -> Self::IntoIter;
fn par_iter(self) -> Self::IntoParIter;
}
Expand description
Trait used to create iterators.
Yields Mut
for mutable components.
std::iter::IntoIterator
can’t be used directly because of conflicting implementation.
This trait serves as substitute.
Required Associated Types
type IntoParIter
Required Methods
Returns an iterator over SparseSet
.
Yields Mut
for tracked mutable components.
It deref
s to the component and will flag mutation.
Example
use shipyard::{Component, EntitiesViewMut, IntoIter, ViewMut, World};
#[derive(Component, Clone, Copy)]
struct U32(u32);
#[derive(Component)]
struct USIZE(usize);
let world = World::new();
let (mut entities, mut usizes, mut u32s) = world.borrow::<(EntitiesViewMut, ViewMut<USIZE>, ViewMut<U32>)>().unwrap();
entities.add_entity((&mut usizes, &mut u32s), (USIZE(0), U32(1)));
entities.add_entity((&mut usizes, &mut u32s), (USIZE(2), U32(3)));
(&mut usizes, &u32s).iter().for_each(|(mut x, &y)| {
x.0 += y.0 as usize;
});
Returns an iterator over SparseSet
, its order is based on D
.
Returns Mut
when yielding tracked mutable components.
It deref
s to the component and will flag mutation.
fn par_iter(self) -> Self::IntoParIter
fn par_iter(self) -> Self::IntoParIter
Available on crate feature
parallel
only.Returns a parallel iterator over SparseSet
.
Yields Mut
for tracked mutable components.
It deref
s to the component and will flag mutation.
Example
use rayon::prelude::ParallelIterator;
use shipyard::{Component, EntitiesViewMut, IntoIter, ViewMut, World};
#[derive(Component, Clone, Copy)]
struct U32(u32);
#[derive(Component)]
struct USIZE(usize);
let world = World::new();
let (mut entities, mut usizes, mut u32s) = world.borrow::<(EntitiesViewMut, ViewMut<USIZE>, ViewMut<U32>)>().unwrap();
entities.add_entity((&mut usizes, &mut u32s), (USIZE(0), U32(1)));
entities.add_entity((&mut usizes, &mut u32s), (USIZE(2), U32(3)));
(&mut usizes, &u32s).par_iter().for_each(|(mut x, &y)| {
x.0 += y.0 as usize;
});
Implementations on Foreign Types
sourceimpl<T: IntoAbstract> IntoIter for (T,) where
<T::AbsView as AbstractMut>::Index: From<usize> + Clone,
impl<T: IntoAbstract> IntoIter for (T,) where
<T::AbsView as AbstractMut>::Index: From<usize> + Clone,
type IntoIter = Iter<(<T as IntoAbstract>::AbsView,)>
type IntoParIter = ParIter<(<T as IntoAbstract>::AbsView,)>
fn iter(self) -> Self::IntoIter
fn iter_by<D: 'static>(self) -> Self::IntoIter
sourcefn par_iter(self) -> Self::IntoParIter
fn par_iter(self) -> Self::IntoParIter
Available on crate feature
parallel
only.sourceimpl<A: IntoAbstract, B: IntoAbstract> IntoIter for (A, B) where
<A::AbsView as AbstractMut>::Index: From<usize> + Clone,
<B::AbsView as AbstractMut>::Index: From<usize> + Clone,
impl<A: IntoAbstract, B: IntoAbstract> IntoIter for (A, B) where
<A::AbsView as AbstractMut>::Index: From<usize> + Clone,
<B::AbsView as AbstractMut>::Index: From<usize> + Clone,
type IntoIter = Iter<(<A as IntoAbstract>::AbsView, <B as IntoAbstract>::AbsView)>
type IntoParIter = ParIter<(<A as IntoAbstract>::AbsView, <B as IntoAbstract>::AbsView)>
fn iter(self) -> Self::IntoIter
fn iter_by<Driver: 'static>(self) -> Self::IntoIter
sourcefn par_iter(self) -> Self::IntoParIter
fn par_iter(self) -> Self::IntoParIter
Available on crate feature
parallel
only.sourceimpl<A: IntoAbstract, B: IntoAbstract, C: IntoAbstract> IntoIter for (A, B, C) where
<A::AbsView as AbstractMut>::Index: From<usize> + Clone,
<B::AbsView as AbstractMut>::Index: From<usize> + Clone,
<C::AbsView as AbstractMut>::Index: From<usize> + Clone,
impl<A: IntoAbstract, B: IntoAbstract, C: IntoAbstract> IntoIter for (A, B, C) where
<A::AbsView as AbstractMut>::Index: From<usize> + Clone,
<B::AbsView as AbstractMut>::Index: From<usize> + Clone,
<C::AbsView as AbstractMut>::Index: From<usize> + Clone,
type IntoIter = Iter<(<A as IntoAbstract>::AbsView, <B as IntoAbstract>::AbsView, <C as IntoAbstract>::AbsView)>
type IntoParIter = ParIter<(<A as IntoAbstract>::AbsView, <B as IntoAbstract>::AbsView, <C as IntoAbstract>::AbsView)>
fn iter(self) -> Self::IntoIter
fn iter_by<Driver: 'static>(self) -> Self::IntoIter
sourcefn par_iter(self) -> Self::IntoParIter
fn par_iter(self) -> Self::IntoParIter
Available on crate feature
parallel
only.sourceimpl<A: IntoAbstract, B: IntoAbstract, C: IntoAbstract, D: IntoAbstract> IntoIter for (A, B, C, D) where
<A::AbsView as AbstractMut>::Index: From<usize> + Clone,
<B::AbsView as AbstractMut>::Index: From<usize> + Clone,
<C::AbsView as AbstractMut>::Index: From<usize> + Clone,
<D::AbsView as AbstractMut>::Index: From<usize> + Clone,
impl<A: IntoAbstract, B: IntoAbstract, C: IntoAbstract, D: IntoAbstract> IntoIter for (A, B, C, D) where
<A::AbsView as AbstractMut>::Index: From<usize> + Clone,
<B::AbsView as AbstractMut>::Index: From<usize> + Clone,
<C::AbsView as AbstractMut>::Index: From<usize> + Clone,
<D::AbsView as AbstractMut>::Index: From<usize> + Clone,
type IntoIter = Iter<(<A as IntoAbstract>::AbsView, <B as IntoAbstract>::AbsView, <C as IntoAbstract>::AbsView, <D as IntoAbstract>::AbsView)>
type IntoParIter = ParIter<(<A as IntoAbstract>::AbsView, <B as IntoAbstract>::AbsView, <C as IntoAbstract>::AbsView, <D as IntoAbstract>::AbsView)>
fn iter(self) -> Self::IntoIter
fn iter_by<Driver: 'static>(self) -> Self::IntoIter
sourcefn par_iter(self) -> Self::IntoParIter
fn par_iter(self) -> Self::IntoParIter
Available on crate feature
parallel
only.sourceimpl<A: IntoAbstract, B: IntoAbstract, C: IntoAbstract, D: IntoAbstract, E: IntoAbstract> IntoIter for (A, B, C, D, E) where
<A::AbsView as AbstractMut>::Index: From<usize> + Clone,
<B::AbsView as AbstractMut>::Index: From<usize> + Clone,
<C::AbsView as AbstractMut>::Index: From<usize> + Clone,
<D::AbsView as AbstractMut>::Index: From<usize> + Clone,
<E::AbsView as AbstractMut>::Index: From<usize> + Clone,
impl<A: IntoAbstract, B: IntoAbstract, C: IntoAbstract, D: IntoAbstract, E: IntoAbstract> IntoIter for (A, B, C, D, E) where
<A::AbsView as AbstractMut>::Index: From<usize> + Clone,
<B::AbsView as AbstractMut>::Index: From<usize> + Clone,
<C::AbsView as AbstractMut>::Index: From<usize> + Clone,
<D::AbsView as AbstractMut>::Index: From<usize> + Clone,
<E::AbsView as AbstractMut>::Index: From<usize> + Clone,
type IntoIter = Iter<(<A as IntoAbstract>::AbsView, <B as IntoAbstract>::AbsView, <C as IntoAbstract>::AbsView, <D as IntoAbstract>::AbsView, <E as IntoAbstract>::AbsView)>
type IntoParIter = ParIter<(<A as IntoAbstract>::AbsView, <B as IntoAbstract>::AbsView, <C as IntoAbstract>::AbsView, <D as IntoAbstract>::AbsView, <E as IntoAbstract>::AbsView)>
fn iter(self) -> Self::IntoIter
fn iter_by<Driver: 'static>(self) -> Self::IntoIter
sourcefn par_iter(self) -> Self::IntoParIter
fn par_iter(self) -> Self::IntoParIter
Available on crate feature
parallel
only.sourceimpl<A: IntoAbstract, B: IntoAbstract, C: IntoAbstract, D: IntoAbstract, E: IntoAbstract, F: IntoAbstract> IntoIter for (A, B, C, D, E, F) where
<A::AbsView as AbstractMut>::Index: From<usize> + Clone,
<B::AbsView as AbstractMut>::Index: From<usize> + Clone,
<C::AbsView as AbstractMut>::Index: From<usize> + Clone,
<D::AbsView as AbstractMut>::Index: From<usize> + Clone,
<E::AbsView as AbstractMut>::Index: From<usize> + Clone,
<F::AbsView as AbstractMut>::Index: From<usize> + Clone,
impl<A: IntoAbstract, B: IntoAbstract, C: IntoAbstract, D: IntoAbstract, E: IntoAbstract, F: IntoAbstract> IntoIter for (A, B, C, D, E, F) where
<A::AbsView as AbstractMut>::Index: From<usize> + Clone,
<B::AbsView as AbstractMut>::Index: From<usize> + Clone,
<C::AbsView as AbstractMut>::Index: From<usize> + Clone,
<D::AbsView as AbstractMut>::Index: From<usize> + Clone,
<E::AbsView as AbstractMut>::Index: From<usize> + Clone,
<F::AbsView as AbstractMut>::Index: From<usize> + Clone,
type IntoIter = Iter<(<A as IntoAbstract>::AbsView, <B as IntoAbstract>::AbsView, <C as IntoAbstract>::AbsView, <D as IntoAbstract>::AbsView, <E as IntoAbstract>::AbsView, <F as IntoAbstract>::AbsView)>
type IntoParIter = ParIter<(<A as IntoAbstract>::AbsView, <B as IntoAbstract>::AbsView, <C as IntoAbstract>::AbsView, <D as IntoAbstract>::AbsView, <E as IntoAbstract>::AbsView, <F as IntoAbstract>::AbsView)>
fn iter(self) -> Self::IntoIter
fn iter_by<Driver: 'static>(self) -> Self::IntoIter
sourcefn par_iter(self) -> Self::IntoParIter
fn par_iter(self) -> Self::IntoParIter
Available on crate feature
parallel
only.sourceimpl<A: IntoAbstract, B: IntoAbstract, C: IntoAbstract, D: IntoAbstract, E: IntoAbstract, F: IntoAbstract, G: IntoAbstract> IntoIter for (A, B, C, D, E, F, G) where
<A::AbsView as AbstractMut>::Index: From<usize> + Clone,
<B::AbsView as AbstractMut>::Index: From<usize> + Clone,
<C::AbsView as AbstractMut>::Index: From<usize> + Clone,
<D::AbsView as AbstractMut>::Index: From<usize> + Clone,
<E::AbsView as AbstractMut>::Index: From<usize> + Clone,
<F::AbsView as AbstractMut>::Index: From<usize> + Clone,
<G::AbsView as AbstractMut>::Index: From<usize> + Clone,
impl<A: IntoAbstract, B: IntoAbstract, C: IntoAbstract, D: IntoAbstract, E: IntoAbstract, F: IntoAbstract, G: IntoAbstract> IntoIter for (A, B, C, D, E, F, G) where
<A::AbsView as AbstractMut>::Index: From<usize> + Clone,
<B::AbsView as AbstractMut>::Index: From<usize> + Clone,
<C::AbsView as AbstractMut>::Index: From<usize> + Clone,
<D::AbsView as AbstractMut>::Index: From<usize> + Clone,
<E::AbsView as AbstractMut>::Index: From<usize> + Clone,
<F::AbsView as AbstractMut>::Index: From<usize> + Clone,
<G::AbsView as AbstractMut>::Index: From<usize> + Clone,
type IntoIter = Iter<(<A as IntoAbstract>::AbsView, <B as IntoAbstract>::AbsView, <C as IntoAbstract>::AbsView, <D as IntoAbstract>::AbsView, <E as IntoAbstract>::AbsView, <F as IntoAbstract>::AbsView, <G as IntoAbstract>::AbsView)>
type IntoParIter = ParIter<(<A as IntoAbstract>::AbsView, <B as IntoAbstract>::AbsView, <C as IntoAbstract>::AbsView, <D as IntoAbstract>::AbsView, <E as IntoAbstract>::AbsView, <F as IntoAbstract>::AbsView, <G as IntoAbstract>::AbsView)>
fn iter(self) -> Self::IntoIter
fn iter_by<Driver: 'static>(self) -> Self::IntoIter
sourcefn par_iter(self) -> Self::IntoParIter
fn par_iter(self) -> Self::IntoParIter
Available on crate feature
parallel
only.sourceimpl<A: IntoAbstract, B: IntoAbstract, C: IntoAbstract, D: IntoAbstract, E: IntoAbstract, F: IntoAbstract, G: IntoAbstract, H: IntoAbstract> IntoIter for (A, B, C, D, E, F, G, H) where
<A::AbsView as AbstractMut>::Index: From<usize> + Clone,
<B::AbsView as AbstractMut>::Index: From<usize> + Clone,
<C::AbsView as AbstractMut>::Index: From<usize> + Clone,
<D::AbsView as AbstractMut>::Index: From<usize> + Clone,
<E::AbsView as AbstractMut>::Index: From<usize> + Clone,
<F::AbsView as AbstractMut>::Index: From<usize> + Clone,
<G::AbsView as AbstractMut>::Index: From<usize> + Clone,
<H::AbsView as AbstractMut>::Index: From<usize> + Clone,
impl<A: IntoAbstract, B: IntoAbstract, C: IntoAbstract, D: IntoAbstract, E: IntoAbstract, F: IntoAbstract, G: IntoAbstract, H: IntoAbstract> IntoIter for (A, B, C, D, E, F, G, H) where
<A::AbsView as AbstractMut>::Index: From<usize> + Clone,
<B::AbsView as AbstractMut>::Index: From<usize> + Clone,
<C::AbsView as AbstractMut>::Index: From<usize> + Clone,
<D::AbsView as AbstractMut>::Index: From<usize> + Clone,
<E::AbsView as AbstractMut>::Index: From<usize> + Clone,
<F::AbsView as AbstractMut>::Index: From<usize> + Clone,
<G::AbsView as AbstractMut>::Index: From<usize> + Clone,
<H::AbsView as AbstractMut>::Index: From<usize> + Clone,
type IntoIter = Iter<(<A as IntoAbstract>::AbsView, <B as IntoAbstract>::AbsView, <C as IntoAbstract>::AbsView, <D as IntoAbstract>::AbsView, <E as IntoAbstract>::AbsView, <F as IntoAbstract>::AbsView, <G as IntoAbstract>::AbsView, <H as IntoAbstract>::AbsView)>
type IntoParIter = ParIter<(<A as IntoAbstract>::AbsView, <B as IntoAbstract>::AbsView, <C as IntoAbstract>::AbsView, <D as IntoAbstract>::AbsView, <E as IntoAbstract>::AbsView, <F as IntoAbstract>::AbsView, <G as IntoAbstract>::AbsView, <H as IntoAbstract>::AbsView)>
fn iter(self) -> Self::IntoIter
fn iter_by<Driver: 'static>(self) -> Self::IntoIter
sourcefn par_iter(self) -> Self::IntoParIter
fn par_iter(self) -> Self::IntoParIter
Available on crate feature
parallel
only.sourceimpl<A: IntoAbstract, B: IntoAbstract, C: IntoAbstract, D: IntoAbstract, E: IntoAbstract, F: IntoAbstract, G: IntoAbstract, H: IntoAbstract, I: IntoAbstract> IntoIter for (A, B, C, D, E, F, G, H, I) where
<A::AbsView as AbstractMut>::Index: From<usize> + Clone,
<B::AbsView as AbstractMut>::Index: From<usize> + Clone,
<C::AbsView as AbstractMut>::Index: From<usize> + Clone,
<D::AbsView as AbstractMut>::Index: From<usize> + Clone,
<E::AbsView as AbstractMut>::Index: From<usize> + Clone,
<F::AbsView as AbstractMut>::Index: From<usize> + Clone,
<G::AbsView as AbstractMut>::Index: From<usize> + Clone,
<H::AbsView as AbstractMut>::Index: From<usize> + Clone,
<I::AbsView as AbstractMut>::Index: From<usize> + Clone,
impl<A: IntoAbstract, B: IntoAbstract, C: IntoAbstract, D: IntoAbstract, E: IntoAbstract, F: IntoAbstract, G: IntoAbstract, H: IntoAbstract, I: IntoAbstract> IntoIter for (A, B, C, D, E, F, G, H, I) where
<A::AbsView as AbstractMut>::Index: From<usize> + Clone,
<B::AbsView as AbstractMut>::Index: From<usize> + Clone,
<C::AbsView as AbstractMut>::Index: From<usize> + Clone,
<D::AbsView as AbstractMut>::Index: From<usize> + Clone,
<E::AbsView as AbstractMut>::Index: From<usize> + Clone,
<F::AbsView as AbstractMut>::Index: From<usize> + Clone,
<G::AbsView as AbstractMut>::Index: From<usize> + Clone,
<H::AbsView as AbstractMut>::Index: From<usize> + Clone,
<I::AbsView as AbstractMut>::Index: From<usize> + Clone,
type IntoIter = Iter<(<A as IntoAbstract>::AbsView, <B as IntoAbstract>::AbsView, <C as IntoAbstract>::AbsView, <D as IntoAbstract>::AbsView, <E as IntoAbstract>::AbsView, <F as IntoAbstract>::AbsView, <G as IntoAbstract>::AbsView, <H as IntoAbstract>::AbsView, <I as IntoAbstract>::AbsView)>
type IntoParIter = ParIter<(<A as IntoAbstract>::AbsView, <B as IntoAbstract>::AbsView, <C as IntoAbstract>::AbsView, <D as IntoAbstract>::AbsView, <E as IntoAbstract>::AbsView, <F as IntoAbstract>::AbsView, <G as IntoAbstract>::AbsView, <H as IntoAbstract>::AbsView, <I as IntoAbstract>::AbsView)>
fn iter(self) -> Self::IntoIter
fn iter_by<Driver: 'static>(self) -> Self::IntoIter
sourcefn par_iter(self) -> Self::IntoParIter
fn par_iter(self) -> Self::IntoParIter
Available on crate feature
parallel
only.sourceimpl<A: IntoAbstract, B: IntoAbstract, C: IntoAbstract, D: IntoAbstract, E: IntoAbstract, F: IntoAbstract, G: IntoAbstract, H: IntoAbstract, I: IntoAbstract, J: IntoAbstract> IntoIter for (A, B, C, D, E, F, G, H, I, J) where
<A::AbsView as AbstractMut>::Index: From<usize> + Clone,
<B::AbsView as AbstractMut>::Index: From<usize> + Clone,
<C::AbsView as AbstractMut>::Index: From<usize> + Clone,
<D::AbsView as AbstractMut>::Index: From<usize> + Clone,
<E::AbsView as AbstractMut>::Index: From<usize> + Clone,
<F::AbsView as AbstractMut>::Index: From<usize> + Clone,
<G::AbsView as AbstractMut>::Index: From<usize> + Clone,
<H::AbsView as AbstractMut>::Index: From<usize> + Clone,
<I::AbsView as AbstractMut>::Index: From<usize> + Clone,
<J::AbsView as AbstractMut>::Index: From<usize> + Clone,
impl<A: IntoAbstract, B: IntoAbstract, C: IntoAbstract, D: IntoAbstract, E: IntoAbstract, F: IntoAbstract, G: IntoAbstract, H: IntoAbstract, I: IntoAbstract, J: IntoAbstract> IntoIter for (A, B, C, D, E, F, G, H, I, J) where
<A::AbsView as AbstractMut>::Index: From<usize> + Clone,
<B::AbsView as AbstractMut>::Index: From<usize> + Clone,
<C::AbsView as AbstractMut>::Index: From<usize> + Clone,
<D::AbsView as AbstractMut>::Index: From<usize> + Clone,
<E::AbsView as AbstractMut>::Index: From<usize> + Clone,
<F::AbsView as AbstractMut>::Index: From<usize> + Clone,
<G::AbsView as AbstractMut>::Index: From<usize> + Clone,
<H::AbsView as AbstractMut>::Index: From<usize> + Clone,
<I::AbsView as AbstractMut>::Index: From<usize> + Clone,
<J::AbsView as AbstractMut>::Index: From<usize> + Clone,
type IntoIter = Iter<(<A as IntoAbstract>::AbsView, <B as IntoAbstract>::AbsView, <C as IntoAbstract>::AbsView, <D as IntoAbstract>::AbsView, <E as IntoAbstract>::AbsView, <F as IntoAbstract>::AbsView, <G as IntoAbstract>::AbsView, <H as IntoAbstract>::AbsView, <I as IntoAbstract>::AbsView, <J as IntoAbstract>::AbsView)>
type IntoParIter = ParIter<(<A as IntoAbstract>::AbsView, <B as IntoAbstract>::AbsView, <C as IntoAbstract>::AbsView, <D as IntoAbstract>::AbsView, <E as IntoAbstract>::AbsView, <F as IntoAbstract>::AbsView, <G as IntoAbstract>::AbsView, <H as IntoAbstract>::AbsView, <I as IntoAbstract>::AbsView, <J as IntoAbstract>::AbsView)>
fn iter(self) -> Self::IntoIter
fn iter_by<Driver: 'static>(self) -> Self::IntoIter
sourcefn par_iter(self) -> Self::IntoParIter
fn par_iter(self) -> Self::IntoParIter
Available on crate feature
parallel
only.