pub struct GlobalEntityMap<E: Copy + Eq + Hash + Send + Sync> { /* private fields */ }Expand description
Bidirectional map between world-local entities and their stable GlobalEntity identifiers.
Implementations§
Trait Implementations§
Source§impl<E: Copy + Eq + Hash + Send + Sync> EntityAndGlobalEntityConverter<E> for GlobalEntityMap<E>
impl<E: Copy + Eq + Hash + Send + Sync> EntityAndGlobalEntityConverter<E> for GlobalEntityMap<E>
Source§fn global_entity_to_entity(
&self,
global_entity: &GlobalEntity,
) -> Result<E, EntityDoesNotExistError>
fn global_entity_to_entity( &self, global_entity: &GlobalEntity, ) -> Result<E, EntityDoesNotExistError>
Resolves
global_entity to the corresponding world-local entity E, or returns an error if not found.Source§fn entity_to_global_entity(
&self,
world_entity: &E,
) -> Result<GlobalEntity, EntityDoesNotExistError>
fn entity_to_global_entity( &self, world_entity: &E, ) -> Result<GlobalEntity, EntityDoesNotExistError>
Resolves a world-local
entity to its stable GlobalEntity identifier, or returns an error if not found.Source§impl<E: Copy + Eq + Hash + Send + Sync> GlobalEntitySpawner<E> for GlobalEntityMap<E>
impl<E: Copy + Eq + Hash + Send + Sync> GlobalEntitySpawner<E> for GlobalEntityMap<E>
Source§fn 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.Source§fn 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.Source§fn 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.Source§fn 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.Source§fn to_converter(&self) -> &dyn EntityAndGlobalEntityConverter<E>
fn to_converter(&self) -> &dyn EntityAndGlobalEntityConverter<E>
Returns
self as an EntityAndGlobalEntityConverter reference for read-only lookups.Auto Trait Implementations§
impl<E> Freeze for GlobalEntityMap<E>
impl<E> RefUnwindSafe for GlobalEntityMap<E>where
E: RefUnwindSafe,
impl<E> Send for GlobalEntityMap<E>
impl<E> Sync for GlobalEntityMap<E>
impl<E> Unpin for GlobalEntityMap<E>where
E: Unpin,
impl<E> UnsafeUnpin for GlobalEntityMap<E>
impl<E> UnwindSafe for GlobalEntityMap<E>where
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more