11use alloc:: borrow:: Cow ;
22use bevy:: {
33 ecs:: {
4- bundle:: DynamicBundle ,
4+ bundle:: { BundleFromComponents , DynamicBundle } ,
55 component:: { ComponentId , Components , RequiredComponents , StorageType } ,
6- storage:: Storages ,
76 system:: EntityCommands ,
87 world:: error:: EntityFetchError ,
98 } ,
@@ -186,16 +185,27 @@ all_tuples!(
186185) ;
187186
188187#[ allow( unsafe_code) ]
189- /// SAFETY: This just passes through to the inner [`Bundle`] implementations .
188+ /// SAFETY: This just passes through to the inner [`Bundle`] implementation .
190189unsafe impl < B : Bundle > Bundle for ConstructTuple < B > {
191- fn component_ids (
190+ fn component_ids ( components : & mut Components , ids : & mut impl FnMut ( ComponentId ) ) {
191+ B :: component_ids ( components, ids) ;
192+ }
193+
194+ fn register_required_components (
192195 components : & mut Components ,
193- storages : & mut Storages ,
194- ids : & mut impl FnMut ( ComponentId ) ,
196+ required_components : & mut RequiredComponents ,
195197 ) {
196- B :: component_ids ( components, storages , ids ) ;
198+ B :: register_required_components ( components, required_components ) ;
197199 }
198200
201+ fn get_component_ids ( components : & Components , ids : & mut impl FnMut ( Option < ComponentId > ) ) {
202+ B :: get_component_ids ( components, ids) ;
203+ }
204+ }
205+
206+ #[ allow( unsafe_code) ]
207+ /// SAFETY: This just passes through to the inner [`BundleFromComponents`] implementation.
208+ unsafe impl < B : BundleFromComponents > BundleFromComponents for ConstructTuple < B > {
199209 unsafe fn from_components < T , F > ( ctx : & mut T , func : & mut F ) -> Self
200210 where
201211 // Ensure that the `OwningPtr` is used correctly
@@ -207,21 +217,11 @@ unsafe impl<B: Bundle> Bundle for ConstructTuple<B> {
207217 unsafe { B :: from_components ( ctx, func) } ,
208218 )
209219 }
210-
211- fn register_required_components (
212- components : & mut Components ,
213- storages : & mut Storages ,
214- required_components : & mut RequiredComponents ,
215- ) {
216- B :: register_required_components ( components, storages, required_components) ;
217- }
218-
219- fn get_component_ids ( components : & Components , ids : & mut impl FnMut ( Option < ComponentId > ) ) {
220- B :: get_component_ids ( components, ids) ;
221- }
222220}
223221
224222impl < B : Bundle > DynamicBundle for ConstructTuple < B > {
223+ type Effect = ( ) ;
224+
225225 fn get_components ( self , func : & mut impl FnMut ( StorageType , OwningPtr < ' _ > ) ) {
226226 self . 0 . get_components ( func) ;
227227 }
0 commit comments