Trait rin::ecs::EntitiesCreationExt [−][src]
pub trait EntitiesCreationExt<'a> {
pub fn with_entities_creation<'e, F, R>(&'e mut self, f: F) -> R
where
F: FnOnce(EntitiesCreation<'e>) -> R;
pub fn new_entity(&mut self) -> EntityBuilder<'_>;
pub fn creation_storage<C>(&mut self) -> CreationSto<'_, C>
where
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,
{ ... }
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,
{ ... }
pub fn add_tag_to<C>(&mut self, entity: &Entity)
where
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,
{ ... }
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,
{ ... }
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,
{ ... }
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,
{ ... }
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,
{ ... }
pub fn remove_entity(&mut self, entity: &Entity) { ... }
}Trait implemented by World and CreationProxy allows to create
functions that can create new entities, components and resources
without relying on an specific object
That way a such function can be called during initialization passing a World as parameter or during run time passing a CreationProxy
Wrappers for World should implement this trait
Required methods
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]
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 creation_storage<C>(&mut self) -> CreationSto<'_, C> where
C: Component, [src]
C: Component,
Provided methods
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,
Adds a Send Component to an already existing Entity.
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,
Adds a non Send Component to an already existing Entity.
pub fn add_tag_to<C>(&mut self, entity: &Entity) where
C: 'static, [src]
C: 'static,
Adds a Tag to an already existing Entity.
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,
Adds a Send Component to an already existing Entity.
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,
Adds a non Send Component to an already existing Entity.
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,
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>(
&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,
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>(&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,
Removes a compoenent of the specified type from an entity.
pub fn remove_entity(&mut self, entity: &Entity)[src]
Removes an Entity and all it’s compoenents.
Implementors
impl<'a> EntitiesCreationExt<'a> for CreationStorages<'a>[src]
impl<'a> EntitiesCreationExt<'a> for CreationStorages<'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,
impl<'a> EntitiesCreationExt<'a> for CreationProxy<'a>[src]
impl<'a> EntitiesCreationExt<'a> for CreationProxy<'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,
impl<'a> EntitiesCreationExt<'a> for Scene[src]
impl<'a> EntitiesCreationExt<'a> for Scene[src]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 with_entities_creation<'e, F, R>(&'e mut self, f: F) -> R where
F: FnOnce(EntitiesCreation<'e>) -> R, [src]
F: FnOnce(EntitiesCreation<'e>) -> R,
impl<'a> EntitiesCreationExt<'a> for EntitiesCreation<'a>[src]
impl<'a> EntitiesCreationExt<'a> for EntitiesCreation<'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,
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,
impl<'a> EntitiesCreationExt<'a> for World[src]
impl<'a> EntitiesCreationExt<'a> for World[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,