[][src]Struct goggles::entity::Allocator

pub struct Allocator { /* fields omitted */ }

Implementations

impl Allocator[src]

pub fn new() -> Allocator[src]

pub fn kill(&mut self, entity: Entity) -> Result<(), WrongGeneration>[src]

Kill the given entity.

Will return Err(WrongGeneration) if the given entity is not the current generation in this allcoator.

pub fn kill_atomic(&self, e: Entity) -> Result<(), WrongGeneration>[src]

Mark an entity to be killed on the next call to Allocator::merge_atomic.

The entity's state is not changed at all until the next call to Allocator::merge_atomic, it is still considered live and may even have Allocator::kill_atomic called on it multiple times.

If the entity is not current at the time of this call, however, then this will return Err(WrongGeneration).

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

Returns whether the given entity has not been killed, and is thus the current generation for this allocator.

More specifically, it checks whether the generation for the given entity is the current alive generation for that index. This generally means that the generation is too old because the Allocator allocated it and then later killed it, but it may also happen if Entitys are improperly mixed between Allocator instances and this entity has a newer generation than the current live one for that index.

pub fn entity(&self, index: Index) -> Option<Entity>[src]

If the given index has a live entity associated with it, returns that live Entity.

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

Allocate a new unique Entity.

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

Allocate an entity atomically.

Atomically allocated entities are immediately valid, live entities indistinguishable from non-atomically allocated entities.

The only observable difference is that the query performance of atomically allocated entities may be slightly worse until merge_atomic is called, at which point they will be merged into the same data structure that keeps track of regular live entities.

pub fn live_bitset(&self) -> LiveBitSet<'_>[src]

Returns a BitSetLike for all live entities.

This is a BitSetOr of the non-atomically live entities and the atomically live entities.

pub fn merge_atomic(&mut self, killed: &mut Vec<Entity>)[src]

Merge all atomic operations done since the last call to Allocator::merge_atomic.

Atomically allocated entities become merged into the faster non-atomic BitSet, and entities marked for deletion with Allocator::kill_atomic actually become killed.

Takes a &mut Vec<Entity> parameter which will be cleared and filled with newly killed entities.

Trait Implementations

impl Debug for Allocator[src]

impl Default for Allocator[src]

impl<'a> Join for &'a Allocator[src]

type Item = Entity

type Access = &'a Allocator

type Mask = LiveBitSet<'a>

Auto Trait Implementations

Blanket Implementations

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

impl<T> Any for T where
    T: Any
[src]

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

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

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

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

impl<T> Pointable for T

type Init = T

The type for initializers.

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.