[][src]Struct quill_prototype::EntityRef

pub struct EntityRef { /* fields omitted */ }

A handle to an entity. Provides access to components.

This handle cannot be sent to another thread, as it requires access to the main server state. To persist entity handles across thread boundaries, you may use EntityId instead.

Implementations

impl EntityRef[src]

pub fn get<T: Component>(self) -> Result<ComponentRef<T>, ComponentError>[src]

Gets a component of this entity.

Returns an error if the entity does not have this component or if the entity no longer exists.

pub fn get_mut<T: Component>(self) -> Result<ComponentRefMut<T>, ComponentError>[src]

Gets a mutable reference to a component of this entity.

Returns an error if the entity does not have this component or if the entity no longer exists.

pub fn add<T: Component>(self, _component: T) -> Result<(), EntityDead>[src]

Adds a component to this entity.

If the entity already has a component of type T, then the component is overwritten.

pub fn send_message(self, _message: &str) -> Result<(), ComponentError>[src]

Sends a message to this entity.

Returns an error if this entity cannot receive a message. (Usually, only players and the console are capable of receiving messages.)

pub fn id(self) -> EntityId[src]

Returns the ID of this entity. This ID can be stored for later use, usually through State::entity.

pub fn position(self) -> Result<Position, ComponentError>[src]

Returns this entity's Position component.

pub fn name(self) -> Result<Name, ComponentError>[src]

Returns this entity's Name component.

pub fn uuid(self) -> Result<Uuid, ComponentError>[src]

Returns this entity's Uuid component.

Trait Implementations

impl Clone for EntityRef[src]

impl Copy for EntityRef[src]

impl Debug for EntityRef[src]

impl Eq for EntityRef[src]

impl Hash for EntityRef[src]

impl PartialEq<EntityRef> for EntityRef[src]

impl StructuralEq for EntityRef[src]

impl StructuralPartialEq for EntityRef[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Component for T where
    T: Send + Sync + 'static, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Resource for T where
    T: Send + Sync + 'static, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.