pub fn remove_component<T: Component>(
        &mut self,
        entity: Entity,
    ) -> Result<(), EntityMutationError> {
        if !self.is_alive(entity) {
            return Err(EntityMutationError::DoesNotExist);
        }

        if self.get_component::<T>(entity).is_some() {
            trace!(
                world = self.id().0,
                ?entity,
                component = std::any::type_name::<T>(),
                "Removing component from entity"
            );

            // move the entity into a suitable chunk
            self.move_entity(entity, &[], &[ComponentTypeId::of::<T>()], &[], &[]);
        }

        Ok(())
    }
/// Removes a component from an entity.
///
/// # Notes
/// This function has the overhead of moving the entity to either an existing or new archetype,
/// causing a memory copy of the entity to a new location. This function should not be used
/// multiple times in successive order.
///
/// `World::remove_components` should be used for adding multiple omponents to an entity at once.
Removes a component from an entity.
Removes a component from an entity .
pub fn remove_component<T: Component>(
        &mut self,
        entity: Entity,
    ) -> Result<(), EntityMutationError> {
        if !self.is_alive(entity) {
            return Err(EntityMutationError::DoesNotExist);
        }
        if self.get_component::<T>(entity).is_some() {
            trace!(
                world = self.id().0,
                ?entity,
                component = std::any::type_name::<T>(),
                "Removing component from entity"
            );
            // move the entity into a suitable chunk
            self.move_entity(entity, &[], &[ComponentTypeId::of::<T>()], &[], &[]);
        }
        Ok(())
    }
pub fn remove_component < T : Component > ( & mut self , entity : Entity , ) -> Result < ( ) , EntityMutationError > { if ! self . is_alive ( entity ) { return Err ( EntityMutationError :: DoesNotExist ) ; } if self . get_component :: < T > ( entity ) . is_some ( ) { trace ! ( world self id ( ) 0 entity component std any type_name T ( ) " " ) ; // move the entity into a suitable chunk self . move_entity ( entity , & [ ] , & [ ComponentTypeId :: of :: < T > ( ) ] , & [ ] , & [ ] ) ; } Ok ( ( ) ) }
Removes a component from an entity.
Removes a component from an entity .
&mut self
entity
Entity
&mut self
entity
Entity
notes
This function has the overhead of moving the entity to either an existing or new archetype,
causing a memory copy of the entity to a new location. This function should not be used
multiple times in successive order.

`World::remove_components` should be used for adding multiple omponents to an entity at once.
This function has the overhead of moving the entity to either an existing or new archetype causing a memory copy of the entity to a new location . This function should not be used multiple times in successive order . ` World :: remove_components ` should be used for adding multiple omponents to an entity at once .