Module specs::world

source · []
Expand description

Entities, resources, components, and general world management.

Structs

An iterator for entity creation. Please note that you have to consume it because iterators are lazy.

An iterator for entity creation. Please note that you have to consume it because iterators are lazy.

The entities of this ECS. This is a resource, stored in the World. If you just want to access it in your system, you can also use the Entities type def.

Entity type, as seen by the user.

The entity builder, allowing to build an entity together with its components.

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

Index generation. When a new entity is placed at an old index, it bumps the Generation by 1. This allows to avoid using components from the entities that were deleted.

Like EntityBuilder, but inserts the component lazily, meaning on maintain. If you need those components to exist immediately, you have to insert them into the storages yourself.

Lazy updates can be used for world updates that need to borrow a lot of resources and as such should better be done at the end. They work lazily in the sense that they are dispatched when calling world.maintain().

A Resource container, which provides methods to insert, access and manage the contained resources.

Traits

A common trait for EntityBuilder and LazyBuilder, allowing either to be used. Entity is definitely alive, but the components may or may not exist before a call to World::maintain.

Abstract component type. Doesn’t have to be Copy or even Clone.

This trait provides some extension methods to make working with shred’s World easier.

Type Definitions

A wrapper for a read Entities resource. Note that this is just Read<Entities>, so you can easily use it in your system:

An index is basically the id of an Entity.