Trait veloren_client::Builder

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

    // Provided method
    fn maybe_with<C>(self, c: Option<C>) -> Self
       where C: Component + Send + Sync,
             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§

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.

Provided Methods§

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

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.

Object Safety§

This trait is not object safe.

Implementors§

§

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

§

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