Trait specs::saveload::MarkedBuilder
source · [−]Expand description
A common trait for EntityBuilder
and LazyBuilder
with a marker function,
allowing either to be used.
Required Methods
Add a Marker
to the entity by fetching the associated allocator.
Examples
use specs::{
prelude::*,
saveload::{MarkedBuilder, SimpleMarker, SimpleMarkerAllocator},
};
struct NetworkSync;
fn mark_entity<M: Builder + MarkedBuilder>(markable: M) -> Entity {
markable
/* .with(Component1) */
.marked::<SimpleMarker<NetworkSync>>()
.build()
}
let mut world = World::new();
world.register::<SimpleMarker<NetworkSync>>();
world.insert(SimpleMarkerAllocator::<NetworkSync>::new());
mark_entity(world.create_entity());