[][src]Enum weasel::entity::EntityId

pub enum EntityId<R: BattleRules> {
    Creature(CreatureId<R>),
    Object(ObjectId<R>),
}

Id to uniquely identify an entity. EntityId is used as global id to identify entities in the game world regardless of their type.

Variants

Creature(CreatureId<R>)

Standard creature.

Object(ObjectId<R>)

Inanimate object.

Implementations

impl<R: BattleRules> EntityId<R>[src]

pub fn is_character(&self) -> bool[src]

Returns whether this entity id refers to an object that satisfies the Character trait.

pub fn is_actor(&self) -> bool[src]

Returns whether this entity id refers to an object that satisfies the Actor trait.

pub fn creature(&self) -> WeaselResult<CreatureId<R>, R>[src]

Extracts a creature id out of this entity id.

Returns an error if the entity id's type is not Creature.

pub fn object(&self) -> WeaselResult<ObjectId<R>, R>[src]

Extracts an object id out of this entity id.

Returns an error if the entity id's type is not Object.

Trait Implementations

impl<R: BattleRules> Clone for EntityId<R>[src]

impl<R: BattleRules> Copy for EntityId<R> where
    CreatureId<R>: Copy,
    ObjectId<R>: Copy
[src]

impl<R: BattleRules> Debug for EntityId<R>[src]

impl<'de, R: BattleRules> Deserialize<'de> for EntityId<R> where
    CreatureId<R>: Deserialize<'de>,
    ObjectId<R>: Deserialize<'de>, 
[src]

impl<R: BattleRules> Display for EntityId<R> where
    CreatureId<R>: Display,
    ObjectId<R>: Display
[src]

impl<R: BattleRules> Eq for EntityId<R>[src]

impl<R: BattleRules> Hash for EntityId<R>[src]

impl<R: BattleRules> PartialEq<EntityId<R>> for EntityId<R>[src]

impl<R: BattleRules> Serialize for EntityId<R> where
    CreatureId<R>: Serialize,
    ObjectId<R>: Serialize
[src]

Auto Trait Implementations

impl<R> RefUnwindSafe for EntityId<R> where
    <<R as BattleRules>::CR as CharacterRules<R>>::CreatureId: RefUnwindSafe,
    <<R as BattleRules>::CR as CharacterRules<R>>::ObjectId: RefUnwindSafe

impl<R> Send for EntityId<R> where
    <<R as BattleRules>::CR as CharacterRules<R>>::CreatureId: Send,
    <<R as BattleRules>::CR as CharacterRules<R>>::ObjectId: Send

impl<R> Sync for EntityId<R> where
    <<R as BattleRules>::CR as CharacterRules<R>>::CreatureId: Sync,
    <<R as BattleRules>::CR as CharacterRules<R>>::ObjectId: Sync

impl<R> Unpin for EntityId<R> where
    <<R as BattleRules>::CR as CharacterRules<R>>::CreatureId: Unpin,
    <<R as BattleRules>::CR as CharacterRules<R>>::ObjectId: Unpin

impl<R> UnwindSafe for EntityId<R> where
    <<R as BattleRules>::CR as CharacterRules<R>>::CreatureId: UnwindSafe,
    <<R as BattleRules>::CR as CharacterRules<R>>::ObjectId: UnwindSafe

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> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

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

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

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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.

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