Skip to main content

EntityMessage

Enum EntityMessage 

Source
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>

Source

pub fn entity(&self) -> Option<E>

Returns the entity carried by this message, or None for Noop.

Source

pub fn is_noop(&self) -> bool

Returns true if this is a Noop message.

Source

pub fn component_kind(&self) -> Option<ComponentKind>

Returns the ComponentKind for insert/remove messages, or None otherwise.

Source

pub fn strip_entity(self) -> EntityMessage<()>

Returns a copy of this message with the entity replaced by (), preserving all other fields.

Source

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.

Source

pub fn get_type(&self) -> EntityMessageType

Returns the EntityMessageType discriminant for this message.

Source

pub fn subcommand_id(&self) -> Option<SubCommandId>

Returns the SubCommandId for messages that carry one, or None for plain commands.

Source

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>

Source

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>

Source

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>

Source§

fn clone(&self) -> EntityMessage<E>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<E: Debug + Copy + Eq + PartialEq> Debug for EntityMessage<E>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<E: PartialEq + Copy + Eq + PartialEq> PartialEq for EntityMessage<E>

Source§

fn eq(&self, other: &EntityMessage<E>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<E: Eq + Copy + Eq + PartialEq> Eq for EntityMessage<E>

Source§

impl<E: Copy + Eq + PartialEq> StructuralPartialEq for EntityMessage<E>

Auto Trait Implementations§

§

impl<E> Freeze for EntityMessage<E>
where E: Freeze,

§

impl<E> RefUnwindSafe for EntityMessage<E>
where E: RefUnwindSafe,

§

impl<E> Send for EntityMessage<E>
where E: Send,

§

impl<E> Sync for EntityMessage<E>
where E: Sync,

§

impl<E> Unpin for EntityMessage<E>
where E: Unpin,

§

impl<E> UnsafeUnpin for EntityMessage<E>
where E: UnsafeUnpin,

§

impl<E> UnwindSafe for EntityMessage<E>
where E: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V