[−][src]Struct goggles::entity::Allocator
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
Entity
s 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
Auto Trait Implementations
impl RefUnwindSafe for Allocator
impl Send for Allocator
impl Sync for Allocator
impl Unpin for Allocator
impl UnwindSafe for Allocator
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Any for T where
T: Any,
[src]
T: Any,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,