pub enum EntityMessage<E: Copy + Eq + PartialEq> {
Show 15 variants
Spawn(E),
SpawnWithComponents(E, Vec<ComponentKind>),
Despawn(E),
InsertComponent(E, ComponentKind),
RemoveComponent(E, ComponentKind),
Publish(SubCommandId, E),
Unpublish(SubCommandId, E),
EnableDelegation(SubCommandId, E),
DisableDelegation(SubCommandId, E),
SetAuthority(SubCommandId, E, EntityAuthStatus),
RequestAuthority(SubCommandId, E),
ReleaseAuthority(SubCommandId, E),
EnableDelegationResponse(SubCommandId, E),
MigrateResponse(SubCommandId, E, RemoteEntity),
Noop,
}Expand description
Per-entity ordered wire message carrying a single entity lifecycle or authority event.
Variants§
Spawn(E)
Spawn entity E with no initial components.
SpawnWithComponents(E, Vec<ComponentKind>)
Spawn entity E pre-loaded with the listed component kinds.
Despawn(E)
Despawn entity E.
InsertComponent(E, ComponentKind)
Insert a component onto entity E.
RemoveComponent(E, ComponentKind)
Remove a component from entity E.
Publish(SubCommandId, E)
Publish entity E (make it visible to other users).
Unpublish(SubCommandId, E)
Retract the publication of entity E.
EnableDelegation(SubCommandId, E)
Enable authority delegation for entity E.
DisableDelegation(SubCommandId, E)
Revoke authority delegation for entity E (server only).
SetAuthority(SubCommandId, E, EntityAuthStatus)
Update authority status for entity E (server only).
RequestAuthority(SubCommandId, E)
Client requests authority over entity E.
ReleaseAuthority(SubCommandId, E)
Client releases authority over entity E.
EnableDelegationResponse(SubCommandId, E)
Client acknowledges that delegation has been enabled for entity E.
MigrateResponse(SubCommandId, E, RemoteEntity)
Entity E has migrated; carries the old remote entity for reconciliation.
Noop
Placeholder that carries no payload.
Implementations§
Source§impl<E: Copy + Eq + PartialEq> EntityMessage<E>
impl<E: Copy + Eq + PartialEq> EntityMessage<E>
Sourcepub fn entity(&self) -> Option<E>
pub fn entity(&self) -> Option<E>
Returns the entity carried by this message, or None for Noop.
Sourcepub fn component_kind(&self) -> Option<ComponentKind>
pub fn component_kind(&self) -> Option<ComponentKind>
Returns the ComponentKind for insert/remove messages, or None otherwise.
Sourcepub fn strip_entity(self) -> EntityMessage<()>
pub fn strip_entity(self) -> EntityMessage<()>
Returns a copy of this message with the entity replaced by (), preserving all other fields.
Sourcepub fn with_entity<O: Copy + Eq + PartialEq>(
self,
entity: O,
) -> EntityMessage<O>
pub fn with_entity<O: Copy + Eq + PartialEq>( self, entity: O, ) -> EntityMessage<O>
Returns this message re-typed with entity replacing the original entity field.
Sourcepub fn get_type(&self) -> EntityMessageType
pub fn get_type(&self) -> EntityMessageType
Returns the EntityMessageType discriminant for this message.
Sourcepub fn subcommand_id(&self) -> Option<SubCommandId>
pub fn subcommand_id(&self) -> Option<SubCommandId>
Returns the SubCommandId for messages that carry one, or None for plain commands.
Sourcepub fn apply_entity_redirect<O: Copy + Eq + PartialEq>(
self,
old_entity: &E,
new_entity: &O,
) -> EntityMessage<O>
pub fn apply_entity_redirect<O: Copy + Eq + PartialEq>( self, old_entity: &E, new_entity: &O, ) -> EntityMessage<O>
Returns self with new_entity substituted wherever old_entity matches the message’s entity field.
Source§impl EntityMessage<RemoteEntity>
impl EntityMessage<RemoteEntity>
Sourcepub fn to_event(self, local_entity_map: &LocalEntityMap) -> EntityEvent
pub fn to_event(self, local_entity_map: &LocalEntityMap) -> EntityEvent
Converts this remote-entity message into an EntityEvent, resolving the entity via local_entity_map.
Source§impl EntityMessage<HostEntity>
impl EntityMessage<HostEntity>
Sourcepub fn to_event(self, local_entity_map: &LocalEntityMap) -> Option<EntityEvent>
pub fn to_event(self, local_entity_map: &LocalEntityMap) -> Option<EntityEvent>
Converts this host-entity message into an EntityEvent, or None if the entity is not found in the map.
Trait Implementations§
Source§impl<E: Clone + Copy + Eq + PartialEq> Clone for EntityMessage<E>
impl<E: Clone + Copy + Eq + PartialEq> Clone for EntityMessage<E>
Source§fn clone(&self) -> EntityMessage<E>
fn clone(&self) -> EntityMessage<E>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<E: PartialEq + Copy + Eq + PartialEq> PartialEq for EntityMessage<E>
impl<E: PartialEq + Copy + Eq + PartialEq> PartialEq for EntityMessage<E>
Source§fn eq(&self, other: &EntityMessage<E>) -> bool
fn eq(&self, other: &EntityMessage<E>) -> bool
self and other values to be equal, and is used by ==.