Trait specs::saveload::MarkedBuilder [−][src]
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());
Implementors
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
.