use super::Entity; use super::component::{Component, ComponentStorage}; pub trait ComponentBundle { fn insert(self, world: &mut W, entity: Entity); } macro_rules! impl_bundle_tuple { ($($T:ident),+) => { impl ComponentBundle for ($($T,)+) where $( $T: Component, W: ComponentStorage<$T>, )+ { #[allow(non_snake_case)] fn insert(self, world: &mut W, entity: Entity) { let ($($T,)+) = self; $( world.insert(entity, $T); )+ } } }; } impl_bundle_tuple!(A); impl_bundle_tuple!(A, B); impl_bundle_tuple!(A, B, C); impl_bundle_tuple!(A, B, C, D); impl_bundle_tuple!(A, B, C, D, E); impl_bundle_tuple!(A, B, C, D, E, F);