pub use itertools::chain;
pub use itertools::izip;
pub use rayon::prelude::*;
pub use zero_ecs_macros::component;
pub use zero_ecs_macros::entity;
pub use zero_ecs_macros::system;
#[macro_export]
macro_rules! izip_par {
( @closure $p:pat => $tup:expr ) => {
|$p| $tup
};
( @closure $p:pat => ( $($tup:tt)* ) , $_iter:expr $( , $tail:expr )* ) => {
$crate::izip_par!(@closure ($p, b) => ( $($tup)*, b ) $( , $tail )*)
};
($first:expr $(,)*) => {
$crate::IntoParallelIterator::into_par_iter($first)
};
($first:expr, $second:expr $(,)*) => {
$crate::izip_par!($first)
.zip($second)
};
( $first:expr $( , $rest:expr )* $(,)* ) => {
$crate::izip_par!($first)
$(
.zip($rest)
)*
.map(
$crate::izip!(@closure a => (a) $( , $rest )*)
)
};
}
#[macro_export]
macro_rules! chain_par {
() => {
rayon::iter::empty()
};
($first:expr $(, $rest:expr )* $(,)?) => {
{
let iter = $crate::IntoParallelIterator::into_par_iter($first);
$(
let iter =
ParallelIterator::chain(
iter,
$crate::IntoParallelIterator::into_par_iter($rest));
)*
iter
}
};
}
#[macro_export]
macro_rules! sum {
($h:expr) => ($h); ($h:expr, $($t:expr),*) =>
(sum!($h) + sum!($($t),*)); }