pub struct EntityResBuilder<'a> {
    pub entity: Entity,
    pub entities: &'a EntitiesRes,
    /* private fields */
}
Expand description

An entity builder from EntitiesRes. Allows building an entity with its components if you have mutable access to the component storages.

Fields

entity: Entity

The entity being built

entities: &'a EntitiesRes

The active borrow to EntitiesRes, used to delete the entity if the builder is dropped without called build().

Implementations

Add a Marker to the entity with the associated allocator, and component storage.

Examples
use specs::{
    prelude::*,
    saveload::{SimpleMarker, SimpleMarkerAllocator},
};

struct NetworkSync;

let mut world = World::new();
world.register::<SimpleMarker<NetworkSync>>();
world.insert(SimpleMarkerAllocator::<NetworkSync>::new());

let mut storage = world.write_storage::<SimpleMarker<NetworkSync>>();
let mut alloc = world.write_resource::<SimpleMarkerAllocator<NetworkSync>>();

let entities = world.entities();
entities
    .build_entity()
    /* .with(Component1) */
    .marked(&mut storage, &mut alloc)
    .build();

Appends a component and associates it with the entity.

Finishes the building and returns the entity.

Trait Implementations

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.