Struct ark_api::world::EntityArena

source ·
pub struct EntityArena { /* private fields */ }
Expand description

An EntityArena is a collection for holding on to entities. Use it to keep track of sets of entities A global arena exists in which entities can be created and cloned

Implementations§

source§

impl EntityArena

source

pub fn insert(&mut self, entity: EntityOwned) -> Entity

Adds an owned entity to the arena

source

pub fn remove(&mut self, entity: Entity) -> Option<EntityOwned>

Removes an entity from the arena using the entity handle, If the entity was in the arena it is returned, otherwise None.

source

pub fn schedule_for_destruction(&mut self, entity: Entity) -> Option<Entity>

Schedules an entity for destruction using the entity handle, Will be destroyed on the next call to destroy_pending_entities. If the entity is in the arena a handle to it is returned, otherwise None.

source

pub fn destroy_pending_entities(&mut self)

Destroys all entities that have been scheduled for destruction using the schedule_for_destruction function.

source

pub fn destroy_all(&mut self)

Destroys all entities in the arena

source

pub fn global() -> &'static mut Self

Returns the global entity arena, used by Entity::create functions

Trait Implementations§

source§

impl Default for EntityArena

source§

fn default() -> EntityArena

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.