Skip to main content

EntityRef

Struct EntityRef 

Source
pub struct EntityRef<'s, E: Copy + Eq + Hash + Send + Sync, W: WorldRefType<E>> { /* private fields */ }
Expand description

Scoped read-only handle for a client entity.

Obtained from Client::entity. Provides read access to components, replication config, authority status, and ownership without borrowing the client mutably.

Implementations§

Source§

impl<'s, E: Copy + Eq + Hash + Send + Sync, W: WorldRefType<E>> EntityRef<'s, E, W>

Source

pub fn new(client: &'s Client<E>, world: W, entity: &E) -> Self

Creates a new EntityRef pointing at entity within world, backed by client for replication queries.

Source

pub fn id(&self) -> E

Returns the underlying entity identifier.

Source

pub fn has_component<R: ReplicatedComponent>(&self) -> bool

Returns true if the entity currently carries component R.

Source

pub fn component<R: ReplicatedComponent>( &self, ) -> Option<ReplicaRefWrapper<'_, R>>

Returns a read-only accessor for component R, or None if the entity does not carry it.

Source

pub fn replication_config(&self) -> Option<Publicity>

Returns the current Publicity, or None if the entity is not registered with the replication layer.

Source

pub fn authority(&self) -> Option<EntityAuthStatus>

Returns the current authority status for this entity, or None if the entity is not configured as Delegated.

Source

pub fn owner(&self) -> EntityOwner

Returns the current EntityOwner — who holds authoritative control over this entity right now.

Auto Trait Implementations§

§

impl<'s, E, W> Freeze for EntityRef<'s, E, W>
where W: Freeze, E: Freeze,

§

impl<'s, E, W> !RefUnwindSafe for EntityRef<'s, E, W>

§

impl<'s, E, W> Send for EntityRef<'s, E, W>
where W: Send,

§

impl<'s, E, W> Sync for EntityRef<'s, E, W>
where W: Sync,

§

impl<'s, E, W> Unpin for EntityRef<'s, E, W>
where W: Unpin, E: Unpin,

§

impl<'s, E, W> UnsafeUnpin for EntityRef<'s, E, W>
where W: UnsafeUnpin, E: UnsafeUnpin,

§

impl<'s, E, W> !UnwindSafe for EntityRef<'s, E, W>

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