pub trait GlobalEntitySpawner<E: Copy + Eq + Hash + Send + Sync>: EntityAndGlobalEntityConverter<E> {
// Required methods
fn spawn(
&mut self,
world_entity: E,
remote_entity_opt: Option<RemoteEntity>,
) -> GlobalEntity;
fn reserve_global_entity(
&mut self,
remote_entity: RemoteEntity,
) -> GlobalEntity;
fn despawn_by_global(&mut self, global_entity: &GlobalEntity);
fn despawn_by_world(&mut self, world_entity: &E);
fn to_converter(&self) -> &dyn EntityAndGlobalEntityConverter<E>;
}Expand description
Extends EntityAndGlobalEntityConverter with the ability to create, reserve, and destroy entity mappings.
Required Methods§
Sourcefn spawn(
&mut self,
world_entity: E,
remote_entity_opt: Option<RemoteEntity>,
) -> GlobalEntity
fn spawn( &mut self, world_entity: E, remote_entity_opt: Option<RemoteEntity>, ) -> GlobalEntity
Registers world_entity in the map, reusing a reserved GlobalEntity for remote_entity_opt if one exists.
Sourcefn reserve_global_entity(&mut self, remote_entity: RemoteEntity) -> GlobalEntity
fn reserve_global_entity(&mut self, remote_entity: RemoteEntity) -> GlobalEntity
Pre-allocates a GlobalEntity slot for remote_entity before the local world entity is spawned.
Sourcefn despawn_by_global(&mut self, global_entity: &GlobalEntity)
fn despawn_by_global(&mut self, global_entity: &GlobalEntity)
Removes the mapping keyed by global_entity, panicking if it does not exist.
Sourcefn despawn_by_world(&mut self, world_entity: &E)
fn despawn_by_world(&mut self, world_entity: &E)
Removes the mapping keyed by world_entity, panicking if it does not exist.
Sourcefn to_converter(&self) -> &dyn EntityAndGlobalEntityConverter<E>
fn to_converter(&self) -> &dyn EntityAndGlobalEntityConverter<E>
Returns self as an EntityAndGlobalEntityConverter reference for read-only lookups.