pub fn remove_bundle_intersection<T: Bundle>(&mut self) {
        let archetypes = &mut self.world.archetypes;
        let storages = &mut self.world.storages;
        let components = &mut self.world.components;
        let entities = &mut self.world.entities;
        let removed_components = &mut self.world.removed_components;

        let bundle_info = self.world.bundles.init_info::<T>(components, storages);
        let old_location = self.location;
        let new_archetype_id = unsafe {
            remove_bundle_from_archetype(
                archetypes,
                storages,
                components,
                old_location.archetype_id,
                bundle_info,
                true,
            )
            .expect("intersections should always return a result")
        };

        if new_archetype_id == old_location.archetype_id {
            return;
        }

        let old_archetype = &mut archetypes[old_location.archetype_id];
        let entity = self.entity;
        for component_id in bundle_info.component_ids.iter().cloned() {
            if old_archetype.contains(component_id) {
                removed_components
                    .get_or_insert_with(component_id, Vec::new)
                    .push(entity);

                // Make sure to drop components stored in sparse sets.
                // Dense components are dropped later in `move_to_and_drop_missing_unchecked`.
                if let Some(StorageType::SparseSet) = old_archetype.get_storage_type(component_id) {
                    storages
                        .sparse_sets
                        .get_mut(component_id)
                        .unwrap()
                        .remove(entity);
                }
            }
        }

        unsafe {
            Self::move_entity_from_remove::<true>(
                entity,
                &mut self.location,
                old_location.archetype_id,
                old_location,
                entities,
                archetypes,
                storages,
                new_archetype_id,
            )
        }
    }
// TODO: move to BundleInfo
/// Remove any components in the bundle that the entity has.
move to BundleInfo
Remove any components in the bundle that the entity has.
move to BundleInfo Remove any components in the bundle that the entity has .
pub fn remove_bundle_intersection<T: Bundle>(&mut self) {
        let archetypes = &mut self.world.archetypes;
        let storages = &mut self.world.storages;
        let components = &mut self.world.components;
        let entities = &mut self.world.entities;
        let removed_components = &mut self.world.removed_components;
        let bundle_info = self.world.bundles.init_info::<T>(components, storages);
        let old_location = self.location;
        let new_archetype_id = unsafe {
            remove_bundle_from_archetype(
                archetypes,
                storages,
                components,
                old_location.archetype_id,
                bundle_info,
                true,
            )
            .expect("intersections should always return a result")
        };
        if new_archetype_id == old_location.archetype_id {
            return;
        }
        let old_archetype = &mut archetypes[old_location.archetype_id];
        let entity = self.entity;
        for component_id in bundle_info.component_ids.iter().cloned() {
            if old_archetype.contains(component_id) {
                removed_components
                    .get_or_insert_with(component_id, Vec::new)
                    .push(entity);
                // Make sure to drop components stored in sparse sets.
                // Dense components are dropped later in `move_to_and_drop_missing_unchecked`.
                if let Some(StorageType::SparseSet) = old_archetype.get_storage_type(component_id) {
                    storages
                        .sparse_sets
                        .get_mut(component_id)
                        .unwrap()
                        .remove(entity);
                }
            }
        }
        unsafe {
            Self::move_entity_from_remove::<true>(
                entity,
                &mut self.location,
                old_location.archetype_id,
                old_location,
                entities,
                archetypes,
                storages,
                new_archetype_id,
            )
        }
    }
pub fn remove_bundle_intersection < T : Bundle > ( & mut self ) { let archetypes = & mut self . world . archetypes ; let storages = & mut self . world . storages ; let components = & mut self . world . components ; let entities = & mut self . world . entities ; let removed_components = & mut self . world . removed_components ; let bundle_info = self . world . bundles . init_info :: < T > ( components , storages ) ; let old_location = self . location ; let new_archetype_id = unsafe { remove_bundle_from_archetype ( archetypes , storages , components , old_location . archetype_id , bundle_info , true , ) . expect ( " " ) } ; if new_archetype_id == old_location . archetype_id { return ; } let old_archetype = & mut archetypes [ old_location . archetype_id ] ; let entity = self . entity ; for component_id in bundle_info . component_ids . iter ( ) . cloned ( ) { if old_archetype . contains ( component_id ) { removed_components . get_or_insert_with ( component_id , Vec :: new ) . push ( entity ) ; // Make sure to drop components stored in sparse sets. // Dense components are dropped later in `move_to_and_drop_missing_unchecked`. if let Some ( StorageType :: SparseSet ) = old_archetype . get_storage_type ( component_id ) { storages . sparse_sets . get_mut ( component_id ) . unwrap ( ) . remove ( entity ) ; } } } unsafe { Self :: move_entity_from_remove :: < true > ( entity , & mut self . location , old_location . archetype_id , old_location , entities , archetypes , storages , new_archetype_id , ) } }
TODO: move to BundleInfo
Remove any components in the bundle that the entity has.
TODO : move to BundleInfo Remove any components in the bundle that the entity has .
&mut self
&mut self