pub fn insert_components(
        &mut self,
        entity: Entity,
        mut components: AnyMap,
    ) -> Result<Option<AnyMap>, UnregisteredComponent> {
        if !self.entities.is_live(entity) {
            return Ok(None);
        }

        let mut overwritten = AnyMap::new();
        for (_, cm) in self.components.iter_mut() {
            cm.insert_entity_from(entity.index(), &mut components, &mut overwritten);
        }

        // If you could get TypeIds out of anymap::raw::RawMap, you could pre-check this rather than
        // post-check it.
        if !components.is_empty() {
            return Err(UnregisteredComponent);
        }

        Ok(Some(overwritten))
    }
/// If the entity is dead, does nothing and returns None, otherwise returns the set of
/// overwritten components.
If the entity is dead, does nothing and returns None, otherwise returns the set of
overwritten components.
If the entity is dead does nothing and returns None otherwise returns the set of overwritten components .
pub fn insert_components(
        &mut self,
        entity: Entity,
        mut components: AnyMap,
    ) -> Result<Option<AnyMap>, UnregisteredComponent> {
        if !self.entities.is_live(entity) {
            return Ok(None);
        }
        let mut overwritten = AnyMap::new();
        for (_, cm) in self.components.iter_mut() {
            cm.insert_entity_from(entity.index(), &mut components, &mut overwritten);
        }
        // If you could get TypeIds out of anymap::raw::RawMap, you could pre-check this rather than
        // post-check it.
        if !components.is_empty() {
            return Err(UnregisteredComponent);
        }
        Ok(Some(overwritten))
    }
pub fn insert_components ( & mut self , entity : Entity , mut components : AnyMap , ) -> Result < Option < AnyMap > , UnregisteredComponent > { if ! self . entities . is_live ( entity ) { return Ok ( None ) ; } let mut overwritten = AnyMap :: new ( ) ; for ( _ , cm ) in self . components . iter_mut ( ) { cm . insert_entity_from ( entity . index ( ) , & mut components , & mut overwritten ) ; } // If you could get TypeIds out of anymap::raw::RawMap, you could pre-check this rather than // post-check it. if ! components . is_empty ( ) { return Err ( UnregisteredComponent ) ; } Ok ( Some ( overwritten ) ) }
If the entity is dead, does nothing and returns None, otherwise returns the set of
overwritten components.
If the entity is dead does nothing and returns None otherwise returns the set of overwritten components .
&mut self
entity
Entity
components
AnyMap
&mut self
entity
Entity
components
AnyMap