Struct Entities

Source
pub struct Entities<R: BattleRules> { /* private fields */ }
Expand description

Data structure to manage ownership of teams and entities.

Implementations§

Source§

impl<R: BattleRules> Entities<R>

Source

pub fn creatures(&self) -> impl Iterator<Item = &Creature<R>>

Returns an iterator over creatures.

Source

pub fn creatures_mut(&mut self) -> impl Iterator<Item = &mut Creature<R>>

Returns a mutable iterator over creatures.

Source

pub fn creature(&self, id: &CreatureId<R>) -> Option<&Creature<R>>

Returns the creature with the given id.

Source

pub fn creature_mut(&mut self, id: &CreatureId<R>) -> Option<&mut Creature<R>>

Returns a mutable reference to the creature with the given id.

Source

pub fn objects(&self) -> impl Iterator<Item = &Object<R>>

Returns an iterator over objects.

Source

pub fn objects_mut(&mut self) -> impl Iterator<Item = &mut Object<R>>

Returns a mutable iterator over objects.

Source

pub fn object(&self, id: &ObjectId<R>) -> Option<&Object<R>>

Returns the object with the given id.

Source

pub fn object_mut(&mut self, id: &ObjectId<R>) -> Option<&mut Object<R>>

Returns a mutable reference to the object with the given id.

Source

pub fn teams(&self) -> impl Iterator<Item = &Team<R>>

Returns an iterator over teams.

Source

pub fn teams_mut(&mut self) -> impl Iterator<Item = &mut Team<R>>

Returns a mutable iterator over teams.

Source

pub fn team(&self, id: &TeamId<R>) -> Option<&Team<R>>

Returns the team with the given id.

Source

pub fn team_mut(&mut self, id: &TeamId<R>) -> Option<&mut Team<R>>

Returns a mutable reference to the team with the given id.

Source

pub fn entities(&self) -> impl Iterator<Item = &dyn Entity<R>>

Returns an iterator over entities.

Source

pub fn entities_mut(&mut self) -> impl Iterator<Item = &mut dyn Entity<R>>

Returns a mutable iterator over entities.

Source

pub fn entity(&self, id: &EntityId<R>) -> Option<&dyn Entity<R>>

Returns the entity with the given id.

Source

pub fn entity_mut(&mut self, id: &EntityId<R>) -> Option<&mut dyn Entity<R>>

Returns a mutable reference to the entity with the given id.

Source

pub fn characters(&self) -> impl Iterator<Item = &dyn Character<R>>

Returns an iterator over characters.

Source

pub fn characters_mut(&mut self) -> impl Iterator<Item = &mut dyn Character<R>>

Returns a mutable iterator over characters.

Source

pub fn character(&self, id: &EntityId<R>) -> Option<&dyn Character<R>>

Returns the character with the given id.

Source

pub fn character_mut( &mut self, id: &EntityId<R>, ) -> Option<&mut dyn Character<R>>

Returns a mutable reference to the character with the given id.

Source

pub fn actors(&self) -> impl Iterator<Item = &dyn Actor<R>>

Returns an iterator over actors.

Source

pub fn actors_mut(&mut self) -> impl Iterator<Item = &mut dyn Actor<R>>

Returns a mutable iterator over actors.

Source

pub fn actor(&self, id: &EntityId<R>) -> Option<&dyn Actor<R>>

Returns the character with the given id.

Source

pub fn actor_mut(&mut self, id: &EntityId<R>) -> Option<&mut dyn Actor<R>>

Returns a mutable reference to the actor with the given id.

Source

pub fn relation( &self, first: &TeamId<R>, second: &TeamId<R>, ) -> Option<Relation>

Returns the Relation between two teams. Relations are symmetric.

The relation of a team towards itself is Kin.

Source

pub fn allies_id<'a>( &'a self, id: &'a TeamId<R>, ) -> impl Iterator<Item = TeamId<R>> + 'a

Returns all allied teams’ id of a team.

Source

pub fn allies<'a>( &'a self, id: &'a TeamId<R>, ) -> impl Iterator<Item = &Team<R>> + 'a

Returns all allied teams of a team.

Source

pub fn enemies_id<'a>( &'a self, id: &'a TeamId<R>, ) -> impl Iterator<Item = TeamId<R>> + 'a

Returns all enemy teams’ id of a team.

Source

pub fn enemies<'a>( &'a self, id: &'a TeamId<R>, ) -> impl Iterator<Item = &Team<R>> + 'a

Returns all enemy teams of a team.

Source

pub fn victorious(&self) -> impl Iterator<Item = &Team<R>>

Returns all victorious teams.

Source

pub fn victorious_id(&self) -> impl Iterator<Item = TeamId<R>> + '_

Returns the id of all victorious teams.

Source

pub fn defeated(&self) -> impl Iterator<Item = &Team<R>>

Returns all defeated teams.

Source

pub fn defeated_id(&self) -> impl Iterator<Item = TeamId<R>> + '_

Returns the id of all defeated teams.

Auto Trait Implementations§

§

impl<R> Freeze for Entities<R>

§

impl<R> RefUnwindSafe for Entities<R>

§

impl<R> Send for Entities<R>
where <<R as BattleRules>::TR as TeamRules<R>>::Objectives: Send, <<R as BattleRules>::TR as TeamRules<R>>::Power: Send, <<R as BattleRules>::CR as CharacterRules<R>>::Statistic: Send, <<R as BattleRules>::AR as ActorRules<R>>::Ability: Send, <<R as BattleRules>::CR as CharacterRules<R>>::Status: Send,

§

impl<R> Sync for Entities<R>
where <<R as BattleRules>::TR as TeamRules<R>>::Id: Sync, <<R as BattleRules>::CR as CharacterRules<R>>::CreatureId: Sync, <<R as BattleRules>::CR as CharacterRules<R>>::ObjectId: Sync, <<R as BattleRules>::TR as TeamRules<R>>::Objectives: Sync, <<R as BattleRules>::SR as SpaceRules<R>>::Position: Sync, <<<R as BattleRules>::TR as TeamRules<R>>::Power as Id>::Id: Sync, <<R as BattleRules>::TR as TeamRules<R>>::Power: Sync, <<<R as BattleRules>::CR as CharacterRules<R>>::Statistic as Id>::Id: Sync, <<R as BattleRules>::CR as CharacterRules<R>>::Statistic: Sync, <<<R as BattleRules>::CR as CharacterRules<R>>::Status as Id>::Id: Sync, <<<R as BattleRules>::AR as ActorRules<R>>::Ability as Id>::Id: Sync, <<R as BattleRules>::AR as ActorRules<R>>::Ability: Sync, <<R as BattleRules>::CR as CharacterRules<R>>::Status: Sync,

§

impl<R> Unpin for Entities<R>
where <<R as BattleRules>::TR as TeamRules<R>>::Id: Unpin, <<R as BattleRules>::CR as CharacterRules<R>>::CreatureId: Unpin, <<R as BattleRules>::CR as CharacterRules<R>>::ObjectId: Unpin, <<R as BattleRules>::TR as TeamRules<R>>::Objectives: Unpin, <<R as BattleRules>::SR as SpaceRules<R>>::Position: Unpin, <<<R as BattleRules>::TR as TeamRules<R>>::Power as Id>::Id: Unpin, <<R as BattleRules>::TR as TeamRules<R>>::Power: Unpin, <<<R as BattleRules>::CR as CharacterRules<R>>::Statistic as Id>::Id: Unpin, <<R as BattleRules>::CR as CharacterRules<R>>::Statistic: Unpin, <<<R as BattleRules>::CR as CharacterRules<R>>::Status as Id>::Id: Unpin, <<<R as BattleRules>::AR as ActorRules<R>>::Ability as Id>::Id: Unpin, <<R as BattleRules>::AR as ActorRules<R>>::Ability: Unpin, <<R as BattleRules>::CR as CharacterRules<R>>::Status: Unpin,

§

impl<R> UnwindSafe for Entities<R>

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