Struct plank_ecs::Entities[][src]

pub struct Entities { /* fields omitted */ }

Holds a list of alive entities. It also holds a list of entities that were recently killed, which allows to remove components of deleted entities at the end of a game frame.

Implementations

impl Entities[src]

pub fn create(&mut self) -> Entity[src]

Creates a new Entity and returns it. This function will not reuse the index of an entity that is still in the killed entities.

pub fn is_alive(&self, entity: Entity) -> bool[src]

Checks if the Entity is still alive. Returns true if it is alive. Returns false if it has been killed.

pub fn kill(&mut self, entity: Entity)[src]

Kill an entity.

pub fn killed(&self) -> &Vec<Entity, Global>[src]

Returns entities in the killed list.

pub fn clear_killed(&mut self)[src]

Clears the killed entity list.

pub fn bitset(&self) -> &Vec<[u32; 8], Global>[src]

Returns a bitset where each index where the bit is set to 1 indicates the index of an alive entity. Useful for joining over Entity and Component<T> at the same time.

pub fn iter_with_bitset(
    &'a self,
    bitset: Rc<Vec<[u32; 8], Global>>
) -> EntityIterator<'a>

Notable traits for EntityIterator<'a>

impl<'a> Iterator for EntityIterator<'a> type Item = Option<Entity>;
[src]

Iterates over entities using the provided bitset.

Trait Implementations

impl Default for Entities[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> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Send + Sync + Any

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[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.