pub unsafe fn into_component_unchecked<T: Component>(
        self,
    ) -> Result<&'a mut T, ComponentError> {
        let component_type = ComponentTypeId::of::<T>();
        if !self.allowed_components.allows_write(component_type) {
            return Err(ComponentError::Denied {
                component_type,
                component_name: std::any::type_name::<T>(),
            });
        }

        let component = self.location.component();
        let archetype = self.location.archetype();
        self.components
            .get_downcast::<T>()
            .and_then(move |storage| storage.get_mut(archetype))
            .and_then(move |slice| slice.into_slice().get_mut(component.0))
            .ok_or_else(|| ComponentError::NotFound {
                component_type,
                component_name: std::any::type_name::<T>(),
            })
    }
/// Returns a mutable reference to one of the entity's components.
///
/// # Safety
/// This function bypasses static borrow checking. The caller must ensure that the component
/// reference will not be mutably aliased.
Returns a mutable reference to one of the entity's components.
Returns a mutable reference to one of the entity ' s components .
pub unsafe fn into_component_unchecked<T: Component>(
        self,
    ) -> Result<&'a mut T, ComponentError> {
        let component_type = ComponentTypeId::of::<T>();
        if !self.allowed_components.allows_write(component_type) {
            return Err(ComponentError::Denied {
                component_type,
                component_name: std::any::type_name::<T>(),
            });
        }
        let component = self.location.component();
        let archetype = self.location.archetype();
        self.components
            .get_downcast::<T>()
            .and_then(move |storage| storage.get_mut(archetype))
            .and_then(move |slice| slice.into_slice().get_mut(component.0))
            .ok_or_else(|| ComponentError::NotFound {
                component_type,
                component_name: std::any::type_name::<T>(),
            })
    }
pub unsafe fn into_component_unchecked < T : Component > ( self , ) -> Result < & ' a mut T , ComponentError > { let component_type = ComponentTypeId :: of :: < T > ( ) ; if ! self . allowed_components . allows_write ( component_type ) { return Err ( ComponentError :: Denied { component_type , component_name : std :: any :: type_name :: < T > ( ) , } ) ; } let component = self . location . component ( ) ; let archetype = self . location . archetype ( ) ; self . components . get_downcast :: < T > ( ) . and_then ( move | storage | storage . get_mut ( archetype ) ) . and_then ( move | slice | slice . into_slice ( ) . get_mut ( component . 0 ) ) . ok_or_else ( | | ComponentError :: NotFound { component_type , component_name : std :: any :: type_name :: < T > ( ) , } ) }
Returns a mutable reference to one of the entity's components.
Returns a mutable reference to one of the entity ' s components .
self
self
safety
This function bypasses static borrow checking. The caller must ensure that the component
reference will not be mutably aliased.
This function bypasses static borrow checking . The caller must ensure that the component reference will not be mutably aliased .