Struct xecs::World

source · []
pub struct World { /* private fields */ }
Expand description

World is the core of XECS.It manages all components and entities

Implementations

Create a empty world.

Register resource in world

Get a read guard of resource

Get a write guard of resource

Register a component.

Panics

Panic if component is registered.

Check if component is registered.

Create an entity without any component in World, return an Entity.

Create count of entities

Details

This funtionn ensures tbe entity id is continuous.

Remove entity and its components.

Attach a component to an entity.

Panics
  • Panic if T is not registered.
  • Panic if entity_id not exist.

Detach a component from an entity.

Details

Return None if entity doesn’t have this component,
otherwise return Some(component)

Panics
  • Panic if T is not registered.
  • Panic if entity_id not exist.

Check if entity_id exists in World.

Get the component storage’s read guard

Get the component storage’s write guard

Get the read guard of component of an entity

Get the write guard of component of an entity

Get an Entity from an entity id

Make a group to accelerate the iteration.

Panics
  • Panic if group is the same as another group in World.
  • Panic if component is owned by another group.

Query entities with conditions

Trait Implementations

Formats the value using the given formatter. 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 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.