use seq_macro::seq; use crate::component::{IntoParts, Parts}; use crate::util::Array; pub trait Bundle { type PartsArray: Array; fn cnt(&self) -> usize; fn into_parts_array(self) -> Self::PartsArray; } macro_rules! gen_tuple_impls { ($c: tt) => { seq!(I in 0..$c { impl<#(IntoCompParts~I: IntoParts,)*> Bundle for (#(IntoCompParts~I,)*) { type PartsArray = [Parts; $c]; fn cnt(&self) -> usize { $c } fn into_parts_array(self) -> Self::PartsArray { [#({ self.I.into_parts() },)*] } } }); }; } seq!(C in 0..17 { gen_tuple_impls!(C); });