[][src]Struct rinecs::CreationProxy

pub struct CreationProxy<'a> { /* fields omitted */ }

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]

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.

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

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

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();

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();

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();

Returns the node for a hierarchical component

Returns the node for a hierarchical component for writing

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();

Adds a Send Component to an already existing Entity.

Adds a non Send Component to an already existing Entity.

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.

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.

Removes a compoenent of the specified type from an entity.

Removes an Entity and all it's compoenents.

Returns a resource of the specified type if it exists for reading.

Returns a resource of the specified type if it exists for writing.

Adds a Send resource to the world.

Resources are globally accesible by any system through the Resources object passed as parameter to them.

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.

Removes a resource of the specified type.

Trait Implementations

impl<'a> EntitiesT<'a> for CreationProxy<'a>
[src]

impl<'a> CreationContext for CreationProxy<'a>
[src]

Auto Trait Implementations

impl<'a> !Send for CreationProxy<'a>

impl<'a> !Sync for CreationProxy<'a>

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: Any
[src]

impl<T> SetParameter for T
[src]

Sets value as a parameter of self.