[]Trait amethyst::prelude::Builder

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

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

fn with<C>(self, c: C) -> Self where
    C: Component + Send + Sync

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.

fn build(self) -> Entity

Finishes the building and returns the entity.

Loading content...

Implementations on Foreign Types

impl<'a> Builder for LazyBuilder<'a>

fn with<C>(self, component: C) -> LazyBuilder<'a> where
    C: Send + Sync + Component, 

Inserts a component using [LazyUpdate].

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

fn build(self) -> Entity

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

impl<'a> Builder for EntityBuilder<'a>

fn with<T>(self, c: T) -> EntityBuilder<'a> where
    T: Component, 

Inserts a component for this entity.

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

fn build(self) -> Entity

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

Loading content...

Implementors

Loading content...