Struct dces::prelude::ComponentStore
source · [−]pub struct ComponentStore { /* private fields */ }
Expand description
The ComponentStore
stores the components of entities and uses strings as component keys. It could be used to
borrow the components of the entities.
Implementations
sourceimpl ComponentStore
impl ComponentStore
sourcepub fn append(
&mut self,
entity: Entity,
components: (BuildComponents, BuildSharedComponents)
)
pub fn append(
&mut self,
entity: Entity,
components: (BuildComponents, BuildSharedComponents)
)
Appends the given components to the entity.
sourcepub fn remove_entity(&mut self, entity: impl Into<Entity>)
pub fn remove_entity(&mut self, entity: impl Into<Entity>)
Removes and entity from the store.
sourcepub fn print_entity(&self, entity: impl Into<Entity>)
pub fn print_entity(&self, entity: impl Into<Entity>)
Print infos about the given entity.
sourcepub fn entities_of_component(
&self,
key: impl Into<String>,
entity: Entity
) -> Vec<Entity>
pub fn entities_of_component(
&self,
key: impl Into<String>,
entity: Entity
) -> Vec<Entity>
Returns a list of entities that references the same component.
sourcepub fn register<C: Component>(
&mut self,
key: impl Into<String>,
entity: Entity,
component: C
)
pub fn register<C: Component>(
&mut self,
key: impl Into<String>,
entity: Entity,
component: C
)
Register a component
for the given entity
.
Registers a sharing of the given component between the given entities. Uses as source key the component key.
Registers a sharing of the given component between the given entities.
Registers a sharing of the given component between the given entities. Uses as source key the component key.
Registers a sharing of the given component between the given entities.
sourcepub fn register_box(
&mut self,
key: &str,
entity: Entity,
component_box: ComponentBox
)
pub fn register_box(
&mut self,
key: &str,
entity: Entity,
component_box: ComponentBox
)
Register a component_box
for the given entity
.
sourcepub fn contains_entity(&self, entity: Entity) -> bool
pub fn contains_entity(&self, entity: Entity) -> bool
Returns true
if the store contains the specific entity.
sourcepub fn is_origin<C: Component>(&self, key: &str, entity: Entity) -> bool
pub fn is_origin<C: Component>(&self, key: &str, entity: Entity) -> bool
Returns true
if entity is the origin of the requested component false
.
sourcepub fn target_key(
&self,
source: Entity,
target: Entity,
source_key: impl Into<String>
) -> Result<String, NotFound>
pub fn target_key(
&self,
source: Entity,
target: Entity,
source_key: impl Into<String>
) -> Result<String, NotFound>
Returns the target key for a given source and target.
sourcepub fn source(
&self,
entity: Entity,
key: impl Into<String>
) -> Result<(Entity, String), NotFound>
pub fn source(
&self,
entity: Entity,
key: impl Into<String>
) -> Result<(Entity, String), NotFound>
Returns the source. First search in entities map. If not found search in shared entity map.
sourcepub fn is<C: Component>(
&self,
key: &str,
entity: Entity
) -> Result<bool, NotFound>
pub fn is<C: Component>(
&self,
key: &str,
entity: Entity
) -> Result<bool, NotFound>
Check if the given component has the given type.
Trait Implementations
sourceimpl Debug for ComponentStore
impl Debug for ComponentStore
sourceimpl Default for ComponentStore
impl Default for ComponentStore
sourcefn default() -> ComponentStore
fn default() -> ComponentStore
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl !RefUnwindSafe for ComponentStore
impl !Send for ComponentStore
impl !Sync for ComponentStore
impl Unpin for ComponentStore
impl !UnwindSafe for ComponentStore
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more