Trait constellation::ComponentResourceApi [] [src]

pub trait ComponentResourceApi {
    type Component;
    fn get(&self, _: Entity) -> Option<&Self::Component>;
    fn get_mut(&mut self, _: Entity) -> Option<&mut Self::Component>;
    unsafe fn get_unchecked(&self, entity: Entity) -> &Self::Component;
    unsafe fn get_unchecked_mut(
        &mut self,
        entity: Entity
    ) -> &mut Self::Component; }

A component resource is a resource which stores data related to entities in the form of a single Self::Component per entity.

Associated Types

The type of data stored for each entity.

Required Methods

Gets a shared reference to the component associated with the given entity, if present.

Gets a mutable reference to the component associated with the given entity, if present.

Gets a shared reference to the component associated with the given entity without performing any bounds or liveness checking.

Safety

This function performs no bounds checking. Requesting data for an entity that does not represent a living entity with data in this resource will return an undefined result.

Gets a mutable reference to the component associated with the given entity without performing any bounds or liveness checking.

Safety

This function performs no bounds checking. Requesting data for an entity that does not represent a living entity with data in this resource will return an undefined result.

Implementors