Trait shipyard::iter::IntoIter[][src]

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; }

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.

Associated Types

Loading content...

Required methods

fn iter(self) -> Self::IntoIter[src]

Returns an iterator over SparseSet.

Yields Mut for mutable components.
It derefs to the component and will flag mutation.
fast_iter can be used if you want an iterator yielding &mut T, it has limitations however.

Example

use shipyard::{EntitiesViewMut, IntoIter, ViewMut, World};

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), (0usize, 1u32));
entities.add_entity((&mut usizes, &mut u32s), (2usize, 3u32));

(&mut usizes, &u32s).iter().for_each(|(mut x, &y)| {
    *x += y as usize;
});

fn iter_by<D: 'static>(self) -> Self::IntoIter[src]

Returns an iterator over SparseSet, its order is based on D.

Returns Mut when yielding mutable components.
It derefs to the component and will flag mutation.
fast_iter_by can be used if you want an iterator yielding &mut T, it has limitations however.

fn par_iter(self) -> Self::IntoParIter[src]

This is supported on crate feature parallel only.

Returns a parallel iterator over SparseSet.

Yields Mut for mutable components.
It derefs to the component and will flag mutation.
fast_par_iter can be used if you want an iterator yielding &mut T, it has limitations however.

Example

use rayon::prelude::ParallelIterator;
use shipyard::{EntitiesViewMut, IntoIter, ViewMut, World};

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), (0usize, 1u32));
entities.add_entity((&mut usizes, &mut u32s), (2usize, 3u32));

(&mut usizes, &u32s).par_iter().for_each(|(mut x, &y)| {
    *x += y as usize;
});
Loading content...

Implementations on Foreign Types

impl<T: IntoAbstract> IntoIter for (T,) where
    <T::AbsView as AbstractMut>::Index: From<usize> + Clone
[src]

type IntoIter = Iter<(T::AbsView,)>

type IntoParIter = ParIter<(T::AbsView,)>

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
[src]

type IntoIter = Iter<(A::AbsView, B::AbsView)>

type IntoParIter = ParIter<(A::AbsView, B::AbsView)>

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
[src]

type IntoIter = Iter<(A::AbsView, B::AbsView, C::AbsView)>

type IntoParIter = ParIter<(A::AbsView, B::AbsView, C::AbsView)>

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
[src]

type IntoIter = Iter<(A::AbsView, B::AbsView, C::AbsView, D::AbsView)>

type IntoParIter = ParIter<(A::AbsView, B::AbsView, C::AbsView, D::AbsView)>

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
[src]

type IntoIter = Iter<(A::AbsView, B::AbsView, C::AbsView, D::AbsView, E::AbsView)>

type IntoParIter = ParIter<(A::AbsView, B::AbsView, C::AbsView, D::AbsView, E::AbsView)>

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
[src]

type IntoIter = Iter<(A::AbsView, B::AbsView, C::AbsView, D::AbsView, E::AbsView, F::AbsView)>

type IntoParIter = ParIter<(A::AbsView, B::AbsView, C::AbsView, D::AbsView, E::AbsView, F::AbsView)>

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
[src]

type IntoIter = Iter<(A::AbsView, B::AbsView, C::AbsView, D::AbsView, E::AbsView, F::AbsView, G::AbsView)>

type IntoParIter = ParIter<(A::AbsView, B::AbsView, C::AbsView, D::AbsView, E::AbsView, F::AbsView, G::AbsView)>

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
[src]

type IntoIter = Iter<(A::AbsView, B::AbsView, C::AbsView, D::AbsView, E::AbsView, F::AbsView, G::AbsView, H::AbsView)>

type IntoParIter = ParIter<(A::AbsView, B::AbsView, C::AbsView, D::AbsView, E::AbsView, F::AbsView, G::AbsView, H::AbsView)>

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
[src]

type IntoIter = Iter<(A::AbsView, B::AbsView, C::AbsView, D::AbsView, E::AbsView, F::AbsView, G::AbsView, H::AbsView, I::AbsView)>

type IntoParIter = ParIter<(A::AbsView, B::AbsView, C::AbsView, D::AbsView, E::AbsView, F::AbsView, G::AbsView, H::AbsView, I::AbsView)>

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
[src]

type IntoIter = Iter<(A::AbsView, B::AbsView, C::AbsView, D::AbsView, E::AbsView, F::AbsView, G::AbsView, H::AbsView, I::AbsView, J::AbsView)>

type IntoParIter = ParIter<(A::AbsView, B::AbsView, C::AbsView, D::AbsView, E::AbsView, F::AbsView, G::AbsView, H::AbsView, I::AbsView, J::AbsView)>

Loading content...

Implementors

impl<T: IntoAbstract> IntoIter for T where
    <T::AbsView as AbstractMut>::Index: Clone
[src]

type IntoIter = Iter<T::AbsView>

type IntoParIter = ParIter<T::AbsView>

Loading content...