Struct veloren_common_net::sync::IdMaps
pub struct IdMaps {
uid_mapping: HashMap<Uid, Entity>,
uid_allocator: UidAllocator,
character_to_ecs: HashMap<CharacterId, Entity>,
rtsim_to_ecs: HashMap<RtSimEntity, Entity>,
}
Expand description
Mappings from various Id types to Entity
s.
Fields§
§uid_mapping: HashMap<Uid, Entity>
§uid_allocator: UidAllocator
§character_to_ecs: HashMap<CharacterId, Entity>
§rtsim_to_ecs: HashMap<RtSimEntity, Entity>
Implementations§
§impl IdMaps
impl IdMaps
pub fn new() -> IdMaps
pub fn uid_entity(&self, id: Uid) -> Option<Entity>
pub fn uid_entity(&self, id: Uid) -> Option<Entity>
Given a Uid
retrieve the corresponding Entity
.
pub fn character_entity(&self, id: CharacterId) -> Option<Entity>
pub fn character_entity(&self, id: CharacterId) -> Option<Entity>
Given a CharacterId
retrieve the corresponding Entity
.
pub fn rtsim_entity(&self, id: RtSimEntity) -> Option<Entity>
pub fn rtsim_entity(&self, id: RtSimEntity) -> Option<Entity>
Given a RtSimEntity
retrieve the corresponding Entity
.
pub fn remove_entity(
&mut self,
expected_entity: Option<Entity>,
uid: Option<Uid>,
cid: Option<CharacterId>,
rid: Option<RtSimEntity>,
) -> Option<Entity>
pub fn remove_entity( &mut self, expected_entity: Option<Entity>, uid: Option<Uid>, cid: Option<CharacterId>, rid: Option<RtSimEntity>, ) -> Option<Entity>
Removes mappings for the provided Id(s).
Returns the Entity
that the provided Uid
was mapped to.
Used on both the client and the server when deleting entities,
although the client only ever provides a Some value for the
Uid
parameter since the other mappings are not used on the
client.
pub fn add_entity(&mut self, uid: Uid, entity: Entity)
pub fn add_entity(&mut self, uid: Uid, entity: Entity)
Only used on the client (server solely uses Self::allocate
to
allocate and add Uid mappings and Self::remap
to move the Uid
to
a different entity).
pub fn add_character(&mut self, cid: CharacterId, entity: Entity)
pub fn add_character(&mut self, cid: CharacterId, entity: Entity)
Only used on the server.
pub fn add_rtsim(&mut self, rid: RtSimEntity, entity: Entity)
pub fn add_rtsim(&mut self, rid: RtSimEntity, entity: Entity)
Only used on the server.
pub fn allocate(&mut self, entity: Entity) -> Uid
pub fn allocate(&mut self, entity: Entity) -> Uid
Allocates a new Uid
and links it to the provided entity.
Only used on the server.
pub fn remap_entity(&mut self, uid: Uid, new_entity: Entity)
pub fn remap_entity(&mut self, uid: Uid, new_entity: Entity)
Links an existing Uid
to a new entity.
Only used on the server.
Used for handle_exit_ingame
which moves the same Uid
to a new
entity.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IdMaps
impl RefUnwindSafe for IdMaps
impl Send for IdMaps
impl Sync for IdMaps
impl Unpin for IdMaps
impl UnwindSafe for IdMaps
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<Context> SubContext<Context> for Context
impl<Context> SubContext<Context> for Context
fn sub_context(self) -> Context
§impl<T> TryDefault for Twhere
T: Default,
impl<T> TryDefault for Twhere
T: Default,
§fn try_default() -> Result<T, String>
fn try_default() -> Result<T, String>
§fn unwrap_default() -> Self
fn unwrap_default() -> Self
try_default
and panics on an error case.