[−][src]Trait rinecs::EntitiesT
Common trait for all Entities like objects.
Allows access and modification of Send
components. Useful to
create functions that can be used from different systems and need
an Entities like parameter.
Required Methods
fn iter_for<'e, S: UnorderedData<'e> + 'a>(
&'e self
) -> <S as UnorderedData<'e>>::Iter
&'e self
) -> <S as UnorderedData<'e>>::Iter
Iterator over all the components that match the operator
for (pos, vel) in entities.iter_for::<(Write<Position>, Read<Velocity>)>(){ pos.x += vel.x; pos.y += vel.y; }
Will iterate over all the entities that have both position and velocity and update the position by adding the velocity to it. In this example position can be modified cause we use the Write operator but velocity can only be read.
fn ordered_iter_for<'e, S: OrderedData<'e> + 'a>(
&'e self
) -> <S as OrderedData<'e>>::Iter
&'e self
) -> <S as OrderedData<'e>>::Iter
Iterator over ordered data
Similar to iter_for but to be used with operators that specify an order like ReadAndParent in which parents will be processed first and then their children
fn iter_for_entities<'e, S, E>(
&'e self,
entities: E
) -> <S as EntitiesData<'e, E>>::Iter where
S: UnorderedData<'e> + 'e,
E: IntoIterator<Item = Entity>,
&'e self,
entities: E
) -> <S as EntitiesData<'e, E>>::Iter where
S: UnorderedData<'e> + 'e,
E: IntoIterator<Item = Entity>,
Iterator for the specified operators over a set of entities instead of every entity in the world
It's usage is similar to iter_for but instead of iterating over all the entities it only returns components that match the operators for the entities passed as parameter
let e1 = world.new_entity() .add(Position{x: 0., y: 0.}) .build(); let e2 = world.new_entity() .add(Position{x: 0., y: 0.}) .build(); let e3 = world.new_entity() .add(Position{x: 0., y: 0.}) .build(); let entities = world.entities(); for pos in entities.iter_for_entities::<Read<Position>, _>(vec![e1, e2]){ //... }
The operators parameter in this method needs a second type for the entities iterator type which can jsut be elided with a _ since it'll be guessed from the passed parameter
fn entity_components<'e, S>(
&'e self,
entity: &Entity
) -> Option<<S as EntitiesComponents<'e>>::Components> where
S: UnorderedData<'e> + 'e,
&'e self,
entity: &Entity
) -> Option<<S as EntitiesComponents<'e>>::Components> where
S: UnorderedData<'e> + 'e,
Similar to iter_for_entities but for one entity instead of several
let e1 = world.new_entity() .add(Position{x: 0., y: 0.}) .add(Velocity{x: 0., y: 0.}) .build(); let entities = world.entities(); let (pos, vel) = entities .entity_components::<(Read<Position>, Read<Velocity>)>(&e1) .unwrap();
fn component_for<C: ComponentSend>(&self, entity: &Entity) -> Option<Ptr<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();
fn component_for_mut<C: ComponentSend>(
&self,
entity: &Entity
) -> Option<PtrMut<C>>
&self,
entity: &Entity
) -> Option<PtrMut<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();
fn tree_node_for<'e, C: ComponentSend>(
&'e self,
entity: &Entity
) -> Option<NodePtr<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
&'e self,
entity: &Entity
) -> Option<NodePtr<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
Returns the node for a hierarchical component
fn tree_node_for_mut<'e, C: ComponentSend>(
&'e self,
entity: &Entity
) -> Option<NodePtrMut<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
&'e self,
entity: &Entity
) -> Option<NodePtrMut<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
Returns the node for a hierarchical component for writing
Implementors
impl<'a> EntitiesT<'a> for CreationProxy<'a>
[src]
impl<'a> EntitiesT<'a> for CreationProxy<'a>
fn iter_for<'e, S: UnorderedData<'e> + 'a>(
&'e self
) -> <S as UnorderedData<'e>>::Iter
[src]
fn iter_for<'e, S: UnorderedData<'e> + 'a>(
&'e self
) -> <S as UnorderedData<'e>>::Iter
fn ordered_iter_for<'e, S: OrderedData<'e> + 'a>(
&'e self
) -> <S as OrderedData<'e>>::Iter
[src]
fn ordered_iter_for<'e, S: OrderedData<'e> + 'a>(
&'e self
) -> <S as OrderedData<'e>>::Iter
fn iter_for_entities<'e, S, E>(
&'e self,
entities: E
) -> <S as EntitiesData<'e, E>>::Iter where
S: UnorderedData<'e> + 'e,
E: IntoIterator<Item = Entity>,
[src]
fn iter_for_entities<'e, S, E>(
&'e self,
entities: E
) -> <S as EntitiesData<'e, E>>::Iter where
S: UnorderedData<'e> + 'e,
E: IntoIterator<Item = Entity>,
fn entity_components<'e, S>(
&'e self,
entity: &Entity
) -> Option<<S as EntitiesComponents<'e>>::Components> where
S: UnorderedData<'e> + 'e,
[src]
fn entity_components<'e, S>(
&'e self,
entity: &Entity
) -> Option<<S as EntitiesComponents<'e>>::Components> where
S: UnorderedData<'e> + 'e,
fn component_for<C: ComponentSend>(&self, entity: &Entity) -> Option<Ptr<C>>
[src]
fn component_for<C: ComponentSend>(&self, entity: &Entity) -> Option<Ptr<C>>
fn component_for_mut<C: ComponentSend>(
&self,
entity: &Entity
) -> Option<PtrMut<C>>
[src]
fn component_for_mut<C: ComponentSend>(
&self,
entity: &Entity
) -> Option<PtrMut<C>>
fn tree_node_for<'e, C: ComponentSend>(
&'e self,
entity: &Entity
) -> Option<NodePtr<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
[src]
fn tree_node_for<'e, C: ComponentSend>(
&'e self,
entity: &Entity
) -> Option<NodePtr<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
fn tree_node_for_mut<'e, C: ComponentSend>(
&'e self,
entity: &Entity
) -> Option<NodePtrMut<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
[src]
fn tree_node_for_mut<'e, C: ComponentSend>(
&'e self,
entity: &Entity
) -> Option<NodePtrMut<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
impl<'a> EntitiesT<'a> for Entities<'a>
[src]
impl<'a> EntitiesT<'a> for Entities<'a>
fn iter_for<'e, S: UnorderedData<'e> + 'a>(
&'e self
) -> <S as UnorderedData<'e>>::Iter
[src]
fn iter_for<'e, S: UnorderedData<'e> + 'a>(
&'e self
) -> <S as UnorderedData<'e>>::Iter
fn ordered_iter_for<'e, S: OrderedData<'e> + 'a>(
&'e self
) -> <S as OrderedData<'e>>::Iter
[src]
fn ordered_iter_for<'e, S: OrderedData<'e> + 'a>(
&'e self
) -> <S as OrderedData<'e>>::Iter
fn iter_for_entities<'e, S, E>(
&'e self,
entities: E
) -> <S as EntitiesData<'e, E>>::Iter where
S: UnorderedData<'e> + 'e,
E: IntoIterator<Item = Entity>,
[src]
fn iter_for_entities<'e, S, E>(
&'e self,
entities: E
) -> <S as EntitiesData<'e, E>>::Iter where
S: UnorderedData<'e> + 'e,
E: IntoIterator<Item = Entity>,
fn entity_components<'e, S>(
&'e self,
entity: &Entity
) -> Option<<S as EntitiesComponents<'e>>::Components> where
S: UnorderedData<'e> + 'e,
[src]
fn entity_components<'e, S>(
&'e self,
entity: &Entity
) -> Option<<S as EntitiesComponents<'e>>::Components> where
S: UnorderedData<'e> + 'e,
fn component_for<C: ComponentSend>(&self, entity: &Entity) -> Option<Ptr<C>>
[src]
fn component_for<C: ComponentSend>(&self, entity: &Entity) -> Option<Ptr<C>>
fn component_for_mut<C: ComponentSend>(
&self,
entity: &Entity
) -> Option<PtrMut<C>>
[src]
fn component_for_mut<C: ComponentSend>(
&self,
entity: &Entity
) -> Option<PtrMut<C>>
fn tree_node_for<'e, C: ComponentSend>(
&'e self,
entity: &Entity
) -> Option<NodePtr<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
[src]
fn tree_node_for<'e, C: ComponentSend>(
&'e self,
entity: &Entity
) -> Option<NodePtr<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
fn tree_node_for_mut<'e, C: ComponentSend>(
&'e self,
entity: &Entity
) -> Option<NodePtrMut<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
[src]
fn tree_node_for_mut<'e, C: ComponentSend>(
&'e self,
entity: &Entity
) -> Option<NodePtrMut<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
impl<'a> EntitiesT<'a> for EntitiesDebug<'a>
[src]
impl<'a> EntitiesT<'a> for EntitiesDebug<'a>
fn iter_for<'e, S: UnorderedData<'e> + 'a>(
&'e self
) -> <S as UnorderedData<'e>>::Iter
[src]
fn iter_for<'e, S: UnorderedData<'e> + 'a>(
&'e self
) -> <S as UnorderedData<'e>>::Iter
fn ordered_iter_for<'e, S: OrderedData<'e> + 'a>(
&'e self
) -> <S as OrderedData<'e>>::Iter
[src]
fn ordered_iter_for<'e, S: OrderedData<'e> + 'a>(
&'e self
) -> <S as OrderedData<'e>>::Iter
fn iter_for_entities<'e, S, E>(
&'e self,
entities: E
) -> <S as EntitiesData<'e, E>>::Iter where
S: UnorderedData<'e> + 'e,
E: IntoIterator<Item = Entity>,
[src]
fn iter_for_entities<'e, S, E>(
&'e self,
entities: E
) -> <S as EntitiesData<'e, E>>::Iter where
S: UnorderedData<'e> + 'e,
E: IntoIterator<Item = Entity>,
fn entity_components<'e, S>(
&'e self,
entity: &Entity
) -> Option<<S as EntitiesComponents<'e>>::Components> where
S: UnorderedData<'e> + 'e,
[src]
fn entity_components<'e, S>(
&'e self,
entity: &Entity
) -> Option<<S as EntitiesComponents<'e>>::Components> where
S: UnorderedData<'e> + 'e,
fn component_for<C: ComponentSend>(&self, entity: &Entity) -> Option<Ptr<C>>
[src]
fn component_for<C: ComponentSend>(&self, entity: &Entity) -> Option<Ptr<C>>
fn component_for_mut<C: ComponentSend>(
&self,
entity: &Entity
) -> Option<PtrMut<C>>
[src]
fn component_for_mut<C: ComponentSend>(
&self,
entity: &Entity
) -> Option<PtrMut<C>>
fn tree_node_for<'e, C: ComponentSend>(
&'e self,
entity: &Entity
) -> Option<NodePtr<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
[src]
fn tree_node_for<'e, C: ComponentSend>(
&'e self,
entity: &Entity
) -> Option<NodePtr<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
fn tree_node_for_mut<'e, C: ComponentSend>(
&'e self,
entity: &Entity
) -> Option<NodePtrMut<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
[src]
fn tree_node_for_mut<'e, C: ComponentSend>(
&'e self,
entity: &Entity
) -> Option<NodePtrMut<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
impl<'a> EntitiesT<'a> for EntitiesThreadLocal<'a>
[src]
impl<'a> EntitiesT<'a> for EntitiesThreadLocal<'a>
fn iter_for<'e, S: UnorderedData<'e> + 'a>(
&'e self
) -> <S as UnorderedData<'e>>::Iter
[src]
fn iter_for<'e, S: UnorderedData<'e> + 'a>(
&'e self
) -> <S as UnorderedData<'e>>::Iter
fn ordered_iter_for<'e, S: OrderedData<'e> + 'a>(
&'e self
) -> <S as OrderedData<'e>>::Iter
[src]
fn ordered_iter_for<'e, S: OrderedData<'e> + 'a>(
&'e self
) -> <S as OrderedData<'e>>::Iter
fn iter_for_entities<'e, S, E>(
&'e self,
entities: E
) -> <S as EntitiesData<'e, E>>::Iter where
S: UnorderedData<'e> + 'e,
E: IntoIterator<Item = Entity>,
[src]
fn iter_for_entities<'e, S, E>(
&'e self,
entities: E
) -> <S as EntitiesData<'e, E>>::Iter where
S: UnorderedData<'e> + 'e,
E: IntoIterator<Item = Entity>,
fn entity_components<'e, S>(
&'e self,
entity: &Entity
) -> Option<<S as EntitiesComponents<'e>>::Components> where
S: UnorderedData<'e> + 'e,
[src]
fn entity_components<'e, S>(
&'e self,
entity: &Entity
) -> Option<<S as EntitiesComponents<'e>>::Components> where
S: UnorderedData<'e> + 'e,
fn component_for<C: ComponentSend>(&self, entity: &Entity) -> Option<Ptr<C>>
[src]
fn component_for<C: ComponentSend>(&self, entity: &Entity) -> Option<Ptr<C>>
fn component_for_mut<C: ComponentSend>(
&self,
entity: &Entity
) -> Option<PtrMut<C>>
[src]
fn component_for_mut<C: ComponentSend>(
&self,
entity: &Entity
) -> Option<PtrMut<C>>
fn tree_node_for<'e, C: ComponentSend>(
&'e self,
entity: &Entity
) -> Option<NodePtr<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
[src]
fn tree_node_for<'e, C: ComponentSend>(
&'e self,
entity: &Entity
) -> Option<NodePtr<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
fn tree_node_for_mut<'e, C: ComponentSend>(
&'e self,
entity: &Entity
) -> Option<NodePtrMut<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
[src]
fn tree_node_for_mut<'e, C: ComponentSend>(
&'e self,
entity: &Entity
) -> Option<NodePtrMut<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,