Async Entity Component System based on the ideas of specs (https://github.com/amethyst/specs)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
614 B

  1. use std::marker::PhantomData;
  2. use crate::{core::{FromParallelIterator, Driver}, ParallelIterator, Executor};
  3. pub struct Collect<X, T> {
  4. iterator: X,
  5. marker: PhantomData<T>,
  6. }
  7. impl<X, T> Collect<X, T> {
  8. pub fn new(iterator: X) -> Self {
  9. Self {
  10. iterator,
  11. marker: PhantomData,
  12. }
  13. }
  14. }
  15. impl<'a, X, T> Driver<'a, T> for Collect<X, T>
  16. where
  17. X: ParallelIterator<'a>,
  18. T: FromParallelIterator<X::Item> + Send,
  19. {
  20. fn exec_with<E>(self, executor: E) -> E::Result
  21. where E: Executor<'a, T>
  22. {
  23. T::from_par_iter(executor, self.iterator)
  24. }
  25. }