use seq_macro::seq; use crate::component::{IntoParts as IntoComponentParts, 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 Bundle for T { fn iter_component_parts(self) -> impl Iterator { [self.into_parts()].into_iter() } }