use seq_macro::seq; use crate::component::Parts as ComponentParts; pub trait Bundle: 'static { fn iter_component_parts(self) -> impl Iterator; } macro_rules! gen_tuple_impls { ($c: tt) => { seq!(I in 0..$c { impl<#(Bundle~I: Bundle,)*> Bundle for (#(Bundle~I,)*) { fn iter_component_parts(self) -> impl Iterator { let parts = [].into_iter(); #( let parts = parts.chain(self.I.iter_component_parts()); )* parts } } }); }; } seq!(C in 0..17 { gen_tuple_impls!(C); }); impl + 'static> Bundle for T { fn iter_component_parts(self) -> impl Iterator { [self.into()].into_iter() } }