pub struct LazyBuilder<'a> {
    pub entity: Entity,
    pub lazy: &'a LazyUpdate,
}
Expand description

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.

Fields

entity: Entity

The entity that we’re inserting components for.

lazy: &'a LazyUpdate

The lazy update reference.

Trait Implementations

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.

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

Add a Marker to the entity by fetching the associated allocator.

This will be applied on the next world.maintain().

Examples
use specs::{
    prelude::*,
    saveload::{MarkedBuilder, SimpleMarker, SimpleMarkerAllocator},
};

struct NetworkSync;

let mut world = World::new();
world.register::<SimpleMarker<NetworkSync>>();
world.insert(SimpleMarkerAllocator::<NetworkSync>::new());

let my_entity = lazy
    .create_entity(&entities)
    /* .with(Component1) */
    .marked::<SimpleMarker<NetworkSync>>()
    .build();
Panics

Panics during world.maintain() in case there’s no allocator added to the World.

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 alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

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.