[−][src]Trait specs::saveload::MarkedBuilder
A common trait for EntityBuilder
and LazyBuilder
with a marker function,
allowing either to be used.
Required methods
fn marked<M: Marker>(self) -> Self
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
impl<'a> MarkedBuilder for EntityBuilder<'a>
[src]
impl<'a> MarkedBuilder for LazyBuilder<'a>
[src]
fn marked<M>(self) -> Self where
M: Marker,
[src]
M: Marker,
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
.