Struct specs::World
[−]
[src]
pub struct World { // some fields omitted }
The world struct contains all the data, which is entities and their components. The methods are supposed to be valid for any context they are available in.
Methods
impl World
[src]
fn new() -> World
Create a new empty world.
fn register<T: Component>(&mut self)
Register a new component type.
fn unregister<T: Component>(&mut self) -> Option<T::Storage>
Unregister a component type.
fn read<T: Component>(&self) -> RwLockReadGuard<T::Storage>
Lock a component's storage for reading.
fn write<T: Component>(&self) -> RwLockWriteGuard<T::Storage>
Lock a component's storage for writing.
fn entities(&self) -> EntityIter
Return the entity iterator.
fn dynamic_entities(&self) -> DynamicEntityIter
Return the dynamic entity iterator. It goes through entities that were dynamically created by systems but not yet merged.
fn create_iter(&self) -> CreateEntityIter
Return the entity creation iterator. Can be used to create many empty entities at once without paying the locking overhead.
fn create_now(&self) -> EntityBuilder
Create a new entity instantly, with locking the generations data.
fn delete_now(&self, entity: Entity)
Delete a new entity instantly, with locking the generations data.
fn create_later(&self) -> Entity
Create a new entity dynamically.
fn delete_later(&self, entity: Entity)
Delete an entity dynamically.
fn merge(&self)
Merge in the appendix, recording all the dynamically created and deleted entities into the persistent generations vector. Also removes all the abandoned components.