Struct specs::World
[−]
[src]
pub struct World { // some fields omitted }
The World
struct contains all the data, which is entities and their components.
All methods are supposed to be valid for any context they are available in.
Methods
impl World
[src]
fn new() -> World
Creates a new empty World
.
fn register<T: Component>(&mut self)
Registers a new component type.
fn unregister<T: Component>(&mut self) -> Option<MaskedStorage<T>>
Unregisters a component type.
fn read<T: Component>(&self) -> Storage<T, RwLockReadGuard<Allocator>, RwLockReadGuard<MaskedStorage<T>>>
Locks a component's storage for reading.
fn write<T: Component>(&self) -> Storage<T, RwLockReadGuard<Allocator>, RwLockWriteGuard<MaskedStorage<T>>>
Locks a component's storage for writing.
fn entities(&self) -> Entities
Returns the entity iterator.
fn create_iter(&self) -> CreateEntities
Returns the entity creation iterator. Can be used to create many empty entities at once without paying the locking overhead.
fn create_now(&self) -> EntityBuilder
Creates a new entity instantly, locking the generations data.
fn delete_now(&self, entity: Entity)
Deletes a new entity instantly, locking the generations data.
fn create_later(&self) -> Entity
Creates a new entity dynamically.
fn delete_later(&self, entity: Entity)
Deletes an entity dynamically.
fn is_alive(&self, entity: Entity) -> bool
Returns true
if the given Entity
is alive.
fn maintain(&self)
Merges in the appendix, recording all the dynamically created and deleted entities into the persistent generations vector. Also removes all the abandoned components.