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>
impl<'s, E: Copy + Eq + Hash + Send + Sync, W: WorldRefType<E>> EntityRef<'s, E, W>
Sourcepub fn new(client: &'s Client<E>, world: W, entity: &E) -> Self
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.
Sourcepub fn has_component<R: ReplicatedComponent>(&self) -> bool
pub fn has_component<R: ReplicatedComponent>(&self) -> bool
Returns true if the entity currently carries component R.
Sourcepub fn component<R: ReplicatedComponent>(
&self,
) -> Option<ReplicaRefWrapper<'_, R>>
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.
Sourcepub fn replication_config(&self) -> Option<Publicity>
pub fn replication_config(&self) -> Option<Publicity>
Returns the current Publicity, or None if the entity is not
registered with the replication layer.
Returns the current authority status for this entity, or None if the
entity is not configured as Delegated.
Sourcepub fn owner(&self) -> EntityOwner
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>
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>
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> 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