Struct rin::ecs::EntityStoragesCreation [−][src]
pub struct EntityStoragesCreation<'a> { /* fields omitted */ }
EntityStoragesCreation
allows
to access and modify components but also to create new components for
already exisiting entities or create new entities and resources.
Implementations
impl<'a> EntityStoragesCreation<'a>
[src]
impl<'a> EntityStoragesCreation<'a>
[src]pub fn update_changed<C>(&self) where
C: ComponentThreadLocal,
<C as Component>::Storage: AutoChangedStorageExt<'a>,
[src]
C: ComponentThreadLocal,
<C as Component>::Storage: AutoChangedStorageExt<'a>,
pub fn has_storage_changed<'r, C>(self) -> bool where
C: ComponentThreadLocal,
<C as Component>::Storage: for<'s> Storage<'s, C>,
<C as Component>::Storage: ChangedStorageExt<'r>,
[src]
C: ComponentThreadLocal,
<C as Component>::Storage: for<'s> Storage<'s, C>,
<C as Component>::Storage: ChangedStorageExt<'r>,
pub fn component_for<C>(&self, entity: &Entity) -> Option<Ptr<'_, C>> where
C: Component,
<C as Component>::Storage: for<'s> Storage<'s, C>,
[src]
C: Component,
<C as Component>::Storage: for<'s> Storage<'s, C>,
Returns a component for reading for the passed entity
let e1 = world.new_entity() .add(Position{x: 0., y: 0.}) .build(); let entities = world.entities(); let pos = entities.component_for::<Position>(&e1).unwrap();
pub fn component_for_mut<C>(&self, entity: &Entity) -> Option<PtrMut<'_, C>> where
C: Component,
<C as Component>::Storage: for<'s> Storage<'s, C>,
[src]
C: Component,
<C as Component>::Storage: for<'s> Storage<'s, C>,
Returns a component for writing for the passed entity
let e1 = world.new_entity() .add(Position{x: 0., y: 0.}) .build(); let entities = world.entities(); let mut pos = entities.component_for_mut::<Position>(&e1).unwrap();
pub fn has_component<C>(&self, entity: &Entity) -> bool where
C: 'static,
[src]
C: 'static,
Returns true if the entity has the specified component
let e1 = world.new_entity() .add(Position{x: 0., y: 0.}) .build(); let entities = world.entities(); assert!(entities.has_component::<Position>(&e1));
pub fn tree_node_for<C>(&self, entity: &Entity) -> Option<NodePtr<'_, C>> where
C: Component,
<C as Component>::Storage: for<'b> HierarchicalStorage<'b, C>,
[src]
C: Component,
<C as Component>::Storage: for<'b> HierarchicalStorage<'b, C>,
Returns the node for a hierarchical component
pub fn tree_node_for_mut<C>(&self, entity: &Entity) -> Option<NodePtrMut<'_, C>> where
C: Component,
<C as Component>::Storage: for<'b> HierarchicalStorage<'b, C>,
[src]
C: Component,
<C as Component>::Storage: for<'b> HierarchicalStorage<'b, C>,
Returns the node for a hierarchical component for writing
pub fn new_entity(&mut self) -> EntityBuilder<'_>
[src]
Returns an EntityBuilder that allows to create an entity and it’s components.
let e = world.new_entity() .add(Position{x: 0., y: 0.}) .add(Velocity{x: 0., y: 0.}) .build();
pub fn add_component_to<'r, C>(&self, entity: &Entity, component: C) where
C: ComponentSend,
<C as Component>::Storage: for<'s> Storage<'s, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
[src]
C: ComponentSend,
<C as Component>::Storage: for<'s> Storage<'s, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
Adds a Send
Component
to an already existing Entity
.
pub fn add_component_to_thread_local<'r, C>(
&self,
entity: &Entity,
component: C
) where
C: ComponentThreadLocal,
<C as Component>::Storage: for<'s> Storage<'s, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
[src]
&self,
entity: &Entity,
component: C
) where
C: ComponentThreadLocal,
<C as Component>::Storage: for<'s> Storage<'s, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
Adds a non Send
Component
to an already existing Entity
.
pub fn add_tag_to<C>(&self, entity: &Entity) where
C: 'static,
[src]
C: 'static,
pub fn add_child_component_to<'r, C>(
&self,
parent: &Entity,
entity: &Entity,
component: C
) where
C: ComponentSend,
<C as Component>::Storage: for<'s> HierarchicalStorage<'s, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
[src]
&self,
parent: &Entity,
entity: &Entity,
component: C
) where
C: ComponentSend,
<C as Component>::Storage: for<'s> HierarchicalStorage<'s, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
Adds a Send
Component
to an already existing Entity
.
pub fn add_child_component_to_thread_local<'r, C>(
&self,
parent: &Entity,
entity: &Entity,
component: C
) where
C: ComponentThreadLocal,
<C as Component>::Storage: for<'s> HierarchicalStorage<'s, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
[src]
&self,
parent: &Entity,
entity: &Entity,
component: C
) where
C: ComponentThreadLocal,
<C as Component>::Storage: for<'s> HierarchicalStorage<'s, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
Adds a non Send
Component
to an already existing Entity
.
pub fn add_slice_component_to<'r, C, I>(&self, entity: &Entity, component: I) where
C: OneToNComponentSend,
I: IntoIterator<Item = C>,
<C as Component>::Storage: for<'s> OneToNStorage<'s, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
[src]
C: OneToNComponentSend,
I: IntoIterator<Item = C>,
<C as Component>::Storage: for<'s> OneToNStorage<'s, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
Adds a Send
OneToNComponent
to an already existing Entity
.
This allows to add a slice of components to an entity instead of only one component. This components are stored contiguously in memory for all the entities.
pub fn add_slice_component_to_thread_local<'r, C, I>(
&self,
entity: &Entity,
component: I
) where
C: OneToNComponentThreadLocal,
I: IntoIterator<Item = C>,
<C as Component>::Storage: for<'s> OneToNStorage<'s, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
[src]
&self,
entity: &Entity,
component: I
) where
C: OneToNComponentThreadLocal,
I: IntoIterator<Item = C>,
<C as Component>::Storage: for<'s> OneToNStorage<'s, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
Adds a non Send
OneToNComponent
to an already existing Entity
.
This allows to add a slice of components to an entity instead of only one component. This components are stored contiguously in memory for all the entities.
pub fn remove_component_from<'r, C>(&self, entity: &Entity) where
C: Component,
<C as Component>::Storage: for<'s> Storage<'s, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
[src]
C: Component,
<C as Component>::Storage: for<'s> Storage<'s, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
Removes a compoenent of the specified type from an entity.
pub fn remove_entity(&self, entity: &Entity)
[src]
Removes an Entity
and all it’s compoenents.
pub fn to_thread_local(&self) -> &EntityStoragesThreadLocal<'_>
[src]
pub fn to_send(&self) -> &EntityStorages<'_>
[src]
pub fn creation_storage<C>(&self) -> CreationSto<'_, C> where
C: Component,
[src]
C: Component,
pub fn storage_for<'r, S>(&'r self) -> Sto<'r, S> where
S: UnorderedData<'r>,
[src]
S: UnorderedData<'r>,
Storage for the operator passed as type parameter
Calling iter_for can be slow if it needs to be called lots of times. In those cases
calling instead storage_for
once and then iter() on it multiple times can make performance
much better
let mut storage = entities.storage_for_mut::<(Write<Position>, Read<Velocity>)>().unwrap(); for i in 0..1000000 { for (pos, vel) in storage.iter_mut() { pos.x += vel.x; pos.y += vel.y; } }
pub fn clone(&self) -> EntitiesCreation<'_>
[src]
Trait Implementations
impl<'a> EntitiesCreationExt<'a> for EntityStoragesCreation<'a>
[src]
impl<'a> EntitiesCreationExt<'a> for EntityStoragesCreation<'a>
[src]pub fn with_entities_creation<'e, F, R>(&'e mut self, f: F) -> R where
F: FnOnce(EntitiesCreation<'e>) -> R,
[src]
F: FnOnce(EntitiesCreation<'e>) -> R,
pub fn new_entity(&mut self) -> EntityBuilder<'_>
[src]
pub fn creation_storage<C>(&mut self) -> CreationSto<'_, C> where
C: Component,
[src]
C: Component,
pub fn add_component_to<'r, C>(&mut self, entity: &Entity, component: C) where
C: ComponentSend,
<C as Component>::Storage: for<'s> Storage<'s, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
[src]
C: ComponentSend,
<C as Component>::Storage: for<'s> Storage<'s, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
pub fn add_component_to_thread_local<'r, C>(
&mut self,
entity: &Entity,
component: C
) where
C: ComponentThreadLocal,
<C as Component>::Storage: for<'s> Storage<'s, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
[src]
&mut self,
entity: &Entity,
component: C
) where
C: ComponentThreadLocal,
<C as Component>::Storage: for<'s> Storage<'s, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
pub fn add_tag_to<C>(&mut self, entity: &Entity) where
C: 'static,
[src]
C: 'static,
pub fn add_child_component_to<'r, C>(
&mut self,
parent: &Entity,
entity: &Entity,
component: C
) where
C: ComponentSend,
<C as Component>::Storage: for<'b> HierarchicalStorage<'b, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
[src]
&mut self,
parent: &Entity,
entity: &Entity,
component: C
) where
C: ComponentSend,
<C as Component>::Storage: for<'b> HierarchicalStorage<'b, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
pub fn add_child_component_to_thread_local<'r, C>(
&mut self,
parent: &Entity,
entity: &Entity,
component: C
) where
C: ComponentThreadLocal,
<C as Component>::Storage: for<'b> HierarchicalStorage<'b, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
[src]
&mut self,
parent: &Entity,
entity: &Entity,
component: C
) where
C: ComponentThreadLocal,
<C as Component>::Storage: for<'b> HierarchicalStorage<'b, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
pub fn add_slice_component_to<'r, C, I>(
&mut self,
entity: &Entity,
component: I
) where
C: OneToNComponentSend,
I: IntoIterator<Item = C>,
<C as Component>::Storage: for<'s> OneToNStorage<'s, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
[src]
&mut self,
entity: &Entity,
component: I
) where
C: OneToNComponentSend,
I: IntoIterator<Item = C>,
<C as Component>::Storage: for<'s> OneToNStorage<'s, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
pub fn add_slice_component_to_thread_local<'r, C, I>(
&mut self,
entity: &Entity,
component: I
) where
C: OneToNComponentThreadLocal,
I: IntoIterator<Item = C>,
<C as Component>::Storage: for<'s> OneToNStorage<'s, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
[src]
&mut self,
entity: &Entity,
component: I
) where
C: OneToNComponentThreadLocal,
I: IntoIterator<Item = C>,
<C as Component>::Storage: for<'s> OneToNStorage<'s, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
pub fn remove_component_from<'r, C>(&mut self, entity: &Entity) where
C: Component,
<C as Component>::Storage: for<'s> Storage<'s, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
[src]
C: Component,
<C as Component>::Storage: for<'s> Storage<'s, C>,
<<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
pub fn remove_entity(&mut self, entity: &Entity)
[src]
impl<'a> EntitiesStorage for EntityStoragesCreation<'a>
[src]
impl<'a> EntitiesStorage for EntityStoragesCreation<'a>
[src]pub fn storage<C>(&self) -> Option<ReadGuardRef<'_, <C as Component>::Storage>> where
C: Component,
[src]
C: Component,
pub fn storage_mut<C>(
&self
) -> Option<WriteGuardRef<'_, <C as Component>::Storage, <C as Component>::MutStorageCacheGuard>> where
C: Component,
[src]
&self
) -> Option<WriteGuardRef<'_, <C as Component>::Storage, <C as Component>::MutStorageCacheGuard>> where
C: Component,
pub fn entities_ref(&self) -> &[(Entity, U256)]ⓘ
[src]
pub fn component_mask<C>(&self) -> U256 where
C: 'static,
[src]
C: 'static,
pub fn entities_for_mask<S>(
&self,
query_mask: Bitmask,
storage: &S
) -> IndexGuard<'_> where
S: FastIndexExt,
[src]
&self,
query_mask: Bitmask,
storage: &S
) -> IndexGuard<'_> where
S: FastIndexExt,
pub fn lazy_entities_for_mask(&self, query_mask: Bitmask) -> LazyIndexGuard<'_>
[src]
pub fn ordered_entities_for<C, S>(
&self,
query_mask: Bitmask,
unordered_storage: &S
) -> OrderedIndexGuard<'_> where
C: Component,
S: FastIndexExt,
<C as Component>::Storage: for<'b> HierarchicalStorage<'b, C>,
[src]
&self,
query_mask: Bitmask,
unordered_storage: &S
) -> OrderedIndexGuard<'_> where
C: Component,
S: FastIndexExt,
<C as Component>::Storage: for<'b> HierarchicalStorage<'b, C>,
impl<'a> EntityStoragesExt<'a> for EntityStoragesCreation<'a>
[src]
impl<'a> EntityStoragesExt<'a> for EntityStoragesCreation<'a>
[src]pub fn component_for<C>(&self, entity: &Entity) -> Option<Ptr<'_, C>> where
C: ComponentSend,
<C as Component>::Storage: for<'s> Storage<'s, C>,
[src]
C: ComponentSend,
<C as Component>::Storage: for<'s> Storage<'s, C>,
pub fn component_for_mut<C>(&self, entity: &Entity) -> Option<PtrMut<'_, C>> where
C: ComponentSend,
<C as Component>::Storage: for<'s> Storage<'s, C>,
[src]
C: ComponentSend,
<C as Component>::Storage: for<'s> Storage<'s, C>,
pub fn has_component<C>(&self, entity: &Entity) -> bool where
C: 'static,
[src]
C: 'static,
pub fn tree_node_for<C>(&self, entity: &Entity) -> Option<NodePtr<'_, C>> where
C: ComponentSend,
<C as Component>::Storage: for<'b> HierarchicalStorage<'b, C>,
[src]
C: ComponentSend,
<C as Component>::Storage: for<'b> HierarchicalStorage<'b, C>,
pub fn tree_node_for_mut<C>(&self, entity: &Entity) -> Option<NodePtrMut<'_, C>> where
C: ComponentSend,
<C as Component>::Storage: for<'b> HierarchicalStorage<'b, C>,
[src]
C: ComponentSend,
<C as Component>::Storage: for<'b> HierarchicalStorage<'b, C>,
pub fn storage_for<'r, S>(&'r self) -> Sto<'r, S> where
S: UnorderedDataSend<'r>,
[src]
S: UnorderedDataSend<'r>,
Auto Trait Implementations
impl<'a> !RefUnwindSafe for EntityStoragesCreation<'a>
impl<'a> !Send for EntityStoragesCreation<'a>
impl<'a> !Sync for EntityStoragesCreation<'a>
impl<'a> Unpin for EntityStoragesCreation<'a>
impl<'a> !UnwindSafe for EntityStoragesCreation<'a>
Blanket Implementations
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]pub fn to_subset(&self) -> Option<SS>
[src]
pub fn is_in_subset(&self) -> bool
[src]
pub fn to_subset_unchecked(&self) -> SS
[src]
pub fn from_subset(element: &SS) -> SP
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]