Trait specs::world::Builder[][src]

pub trait Builder {
    fn with<C: Component + Send + Sync>(self, c: C) -> Self;
fn build(self) -> Entity; fn maybe_with<C: Component + Send + Sync>(self, c: Option<C>) -> Self
    where
        Self: Sized
, { ... } }
Expand description

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.

Required methods

Appends a component and associates it with the entity.

If a component was already associated with the entity, it should overwrite the previous component.

Panics

Panics if the component hasn’t been register()ed in the World.

Finishes the building and returns the entity.

Provided methods

Convenience method that calls self.with(component) if Some(component) is provided

Panics

Panics if the component hasn’t been register()ed in the World.

Implementors

Inserts a component for this entity.

If a component was already associated with the entity, it will overwrite the previous component.

Finishes the building and returns the entity. As opposed to LazyBuilder, the components are available immediately.

Inserts a component using LazyUpdate.

If a component was already associated with the entity, it will overwrite the previous component.

Finishes the building and returns the built entity. Please note that no component is associated to this entity until you call World::maintain.