[−][src]Struct rinecs::CreationProxy
CreationProxy
is passed to CreationSystem
when they are run and allows
to access and modify components but also to create new components for
already exisiting entities or create new entities and resources.
Methods
impl<'a> CreationProxy<'a>
[src]
impl<'a> CreationProxy<'a>
pub fn iter_for<'e, S: UnorderedDataLocal<'e> + 'a>(
&'e self
) -> <S as UnorderedDataLocal<'e>>::Iter
[src]
pub fn iter_for<'e, S: UnorderedDataLocal<'e> + 'a>(
&'e self
) -> <S as UnorderedDataLocal<'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.
pub fn ordered_iter_for<'e, S: OrderedDataLocal<'e> + 'a>(
&'e self
) -> <S as OrderedDataLocal<'e>>::Iter
[src]
pub fn ordered_iter_for<'e, S: OrderedDataLocal<'e> + 'a>(
&'e self
) -> <S as OrderedDataLocal<'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
pub fn iter_for_entities<'e, S, E>(
&'e self,
entities: E
) -> <S as EntitiesDataLocal<'e, E>>::Iter where
S: UnorderedDataLocal<'e> + 'e,
E: IntoIterator<Item = Entity>,
[src]
pub fn iter_for_entities<'e, S, E>(
&'e self,
entities: E
) -> <S as EntitiesDataLocal<'e, E>>::Iter where
S: UnorderedDataLocal<'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
pub fn entity_components<'e, S>(
&'e self,
entity: &Entity
) -> Option<<S as EntitiesComponentsLocal<'e>>::Components> where
S: UnorderedDataLocal<'e> + 'e,
[src]
pub fn entity_components<'e, S>(
&'e self,
entity: &Entity
) -> Option<<S as EntitiesComponentsLocal<'e>>::Components> where
S: UnorderedDataLocal<'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();
pub fn component_for<C: Component>(&self, entity: &Entity) -> Option<Ptr<C>>
[src]
pub fn component_for<C: Component>(&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();
pub fn component_for_mut<C: Component>(
&self,
entity: &Entity
) -> Option<PtrMut<C>>
[src]
pub fn component_for_mut<C: Component>(
&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();
pub fn tree_node_for<'e, C: Component>(
&'e self,
entity: &Entity
) -> Option<NodePtr<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
[src]
pub fn tree_node_for<'e, C: Component>(
&'e self,
entity: &Entity
) -> Option<NodePtr<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
Returns the node for a hierarchical component
pub fn tree_node_for_mut<'e, C: Component>(
&'e self,
entity: &Entity
) -> Option<NodePtrMut<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
[src]
pub fn tree_node_for_mut<'e, C: Component>(
&'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
pub fn new_entity(&mut self) -> EntityBuilder
[src]
pub fn new_entity(&mut self) -> EntityBuilder
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<C: ComponentSend>(
&mut self,
entity: &Entity,
component: C
)
[src]
pub fn add_component_to<C: ComponentSend>(
&mut self,
entity: &Entity,
component: C
)
Adds a Send
Component
to an already existing Entity
.
pub fn add_component_to_thread_local<C: ComponentThreadLocal>(
&mut self,
entity: &Entity,
component: C
)
[src]
pub fn add_component_to_thread_local<C: ComponentThreadLocal>(
&mut self,
entity: &Entity,
component: C
)
Adds a non Send
Component
to an already existing Entity
.
pub fn add_slice_component_to<C, I>(&mut self, entity: &Entity, component: I) where
C: OneToNComponentSend,
<C as Component>::Storage: OneToNStorage<'b, C>,
I: IntoIterator<Item = C>,
[src]
pub fn add_slice_component_to<C, I>(&mut self, entity: &Entity, component: I) where
C: OneToNComponentSend,
<C as Component>::Storage: OneToNStorage<'b, C>,
I: IntoIterator<Item = C>,
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<C, I>(
&mut self,
entity: &Entity,
component: I
) where
C: OneToNComponentThreadLocal,
<C as Component>::Storage: OneToNStorage<'b, C>,
I: IntoIterator<Item = C>,
[src]
pub fn add_slice_component_to_thread_local<C, I>(
&mut self,
entity: &Entity,
component: I
) where
C: OneToNComponentThreadLocal,
<C as Component>::Storage: OneToNStorage<'b, C>,
I: IntoIterator<Item = C>,
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<C: Component>(&mut self, entity: &Entity)
[src]
pub fn remove_component_from<C: Component>(&mut self, entity: &Entity)
Removes a compoenent of the specified type from an entity.
pub fn remove_entity(&mut self, entity: &Entity)
[src]
pub fn remove_entity(&mut self, entity: &Entity)
Removes an Entity
and all it's compoenents.
pub fn resource<T: 'static>(&self) -> Option<RwLockReadGuard<T>>
[src]
pub fn resource<T: 'static>(&self) -> Option<RwLockReadGuard<T>>
Returns a resource of the specified type if it exists for reading.
pub fn resource_mut<T: 'static>(&self) -> Option<RwLockWriteGuard<T>>
[src]
pub fn resource_mut<T: 'static>(&self) -> Option<RwLockWriteGuard<T>>
Returns a resource of the specified type if it exists for writing.
pub fn add_resource<T: 'static + Send>(&mut self, resource: T)
[src]
pub fn add_resource<T: 'static + Send>(&mut self, resource: T)
Adds a Send
resource to the world.
Resources are globally accesible by any system through
the Resources
object passed as parameter to them.
pub fn add_resource_thread_local<T: 'static>(&mut self, resource: T)
[src]
pub fn add_resource_thread_local<T: 'static>(&mut self, resource: T)
Adds a non Send
resource to the world.
Non Send
resources are globally accesible by any SystemThreadLocal
through the ResourcesThreadLocal
object passed as parameter to them.
pub fn remove_resource<T: 'static>(&mut self) -> Option<T>
[src]
pub fn remove_resource<T: 'static>(&mut self) -> Option<T>
Removes a resource of the specified type.
pub fn register<'e, T: ComponentSend>(&'e mut self) where
<<T as Component>::Storage as Storage<'e, T>>::Get: DebugParameter,
[src]
pub fn register<'e, T: ComponentSend>(&'e mut self) where
<<T as Component>::Storage as Storage<'e, T>>::Get: DebugParameter,
pub fn register_thread_local<'e, T: ComponentThreadLocal>(&'e mut self) where
<<T as Component>::Storage as Storage<'e, T>>::Get: DebugParameter,
[src]
pub fn register_thread_local<'e, T: ComponentThreadLocal>(&'e mut self) where
<<T as Component>::Storage as Storage<'e, T>>::Get: DebugParameter,
Trait Implementations
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> CreationContext for CreationProxy<'a>
[src]
impl<'a> CreationContext for CreationProxy<'a>
fn iter_for<'e, S: UnorderedDataLocal<'e> + 'e>(
&'e self
) -> <S as UnorderedDataLocal<'e>>::Iter
[src]
fn iter_for<'e, S: UnorderedDataLocal<'e> + 'e>(
&'e self
) -> <S as UnorderedDataLocal<'e>>::Iter
fn ordered_iter_for<'e, S: OrderedDataLocal<'e> + 'e>(
&'e self
) -> <S as OrderedDataLocal<'e>>::Iter
[src]
fn ordered_iter_for<'e, S: OrderedDataLocal<'e> + 'e>(
&'e self
) -> <S as OrderedDataLocal<'e>>::Iter
fn iter_for_entities<'e, S, E>(
&'e self,
entities: E
) -> <S as EntitiesDataLocal<'e, E>>::Iter where
S: UnorderedDataLocal<'e> + 'e,
E: IntoIterator<Item = Entity>,
[src]
fn iter_for_entities<'e, S, E>(
&'e self,
entities: E
) -> <S as EntitiesDataLocal<'e, E>>::Iter where
S: UnorderedDataLocal<'e> + 'e,
E: IntoIterator<Item = Entity>,
fn entity_components<'e, S>(
&'e self,
entity: &Entity
) -> Option<<S as EntitiesComponentsLocal<'e>>::Components> where
S: UnorderedDataLocal<'e> + 'e,
[src]
fn entity_components<'e, S>(
&'e self,
entity: &Entity
) -> Option<<S as EntitiesComponentsLocal<'e>>::Components> where
S: UnorderedDataLocal<'e> + 'e,
fn component_for<C: Component>(&self, entity: &Entity) -> Option<Ptr<C>>
[src]
fn component_for<C: Component>(&self, entity: &Entity) -> Option<Ptr<C>>
fn component_for_mut<C: Component>(&self, entity: &Entity) -> Option<PtrMut<C>>
[src]
fn component_for_mut<C: Component>(&self, entity: &Entity) -> Option<PtrMut<C>>
fn tree_node_for<'e, C: Component>(
&'e self,
entity: &Entity
) -> Option<NodePtr<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
[src]
fn tree_node_for<'e, C: Component>(
&'e self,
entity: &Entity
) -> Option<NodePtr<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
fn tree_node_for_mut<'e, C: Component>(
&'e self,
entity: &Entity
) -> Option<NodePtrMut<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
[src]
fn tree_node_for_mut<'e, C: Component>(
&'e self,
entity: &Entity
) -> Option<NodePtrMut<'e, C>> where
<C as Component>::Storage: HierarchicalStorage<'e, C>,
fn new_entity(&mut self) -> EntityBuilder
[src]
fn new_entity(&mut self) -> EntityBuilder
fn add_component_to<C: ComponentSend>(&mut self, entity: &Entity, component: C)
[src]
fn add_component_to<C: ComponentSend>(&mut self, entity: &Entity, component: C)
fn add_component_to_thread_local<C: ComponentThreadLocal>(
&mut self,
entity: &Entity,
component: C
)
[src]
fn add_component_to_thread_local<C: ComponentThreadLocal>(
&mut self,
entity: &Entity,
component: C
)
fn add_slice_component_to<C, I>(&mut self, entity: &Entity, component: I) where
C: OneToNComponentSend,
<C as Component>::Storage: OneToNStorage<'b, C>,
I: IntoIterator<Item = C>,
[src]
fn add_slice_component_to<C, I>(&mut self, entity: &Entity, component: I) where
C: OneToNComponentSend,
<C as Component>::Storage: OneToNStorage<'b, C>,
I: IntoIterator<Item = C>,
fn add_slice_component_to_thread_local<C, I>(
&mut self,
entity: &Entity,
component: I
) where
C: OneToNComponentThreadLocal,
<C as Component>::Storage: OneToNStorage<'b, C>,
I: IntoIterator<Item = C>,
[src]
fn add_slice_component_to_thread_local<C, I>(
&mut self,
entity: &Entity,
component: I
) where
C: OneToNComponentThreadLocal,
<C as Component>::Storage: OneToNStorage<'b, C>,
I: IntoIterator<Item = C>,
fn remove_component_from<C: Component>(&mut self, entity: &Entity)
[src]
fn remove_component_from<C: Component>(&mut self, entity: &Entity)
fn remove_entity(&mut self, entity: &Entity)
[src]
fn remove_entity(&mut self, entity: &Entity)
fn resource<T: 'static>(&self) -> Option<RwLockReadGuard<T>>
[src]
fn resource<T: 'static>(&self) -> Option<RwLockReadGuard<T>>
fn resource_mut<T: 'static>(&self) -> Option<RwLockWriteGuard<T>>
[src]
fn resource_mut<T: 'static>(&self) -> Option<RwLockWriteGuard<T>>
fn add_resource<T: 'static + Send>(&mut self, resource: T)
[src]
fn add_resource<T: 'static + Send>(&mut self, resource: T)
fn add_resource_thread_local<T: 'static>(&mut self, resource: T)
[src]
fn add_resource_thread_local<T: 'static>(&mut self, resource: T)
fn remove_resource<T: 'static>(&mut self) -> Option<T>
[src]
fn remove_resource<T: 'static>(&mut self) -> Option<T>
fn register<'e, T: ComponentSend>(&'e mut self) where
<<T as Component>::Storage as Storage<'e, T>>::Get: DebugParameter,
[src]
fn register<'e, T: ComponentSend>(&'e mut self) where
<<T as Component>::Storage as Storage<'e, T>>::Get: DebugParameter,
fn register_thread_local<'e, T: ComponentThreadLocal>(&'e mut self) where
<<T as Component>::Storage as Storage<'e, T>>::Get: DebugParameter,
[src]
fn register_thread_local<'e, T: ComponentThreadLocal>(&'e mut self) where
<<T as Component>::Storage as Storage<'e, T>>::Get: DebugParameter,
Auto Trait Implementations
impl<'a> !Send for CreationProxy<'a>
impl<'a> !Send for CreationProxy<'a>
impl<'a> !Sync for CreationProxy<'a>
impl<'a> !Sync for CreationProxy<'a>
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
impl<T> Any for T where
T: Any,
[src]
impl<T> Any for T where
T: Any,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
impl<T> SetParameter for T
[src]
impl<T> SetParameter for T