pub struct EntityAlloc<E: IEntityAllocatable> { /* private fields */ }Implementations§
Source§impl<E: IEntityAllocatable> EntityAlloc<E>
impl<E: IEntityAllocatable> EntityAlloc<E>
pub fn new() -> Self
pub fn with_capacity(cap: usize) -> Self
pub fn allocate(&self, val: E) -> PtrID<E>
pub fn try_allocate(&self, val: E) -> Result<PtrID<E>, (BorrowMutError, E)>
Sourcepub fn next_indexed(&self) -> IndexedID<E>
pub fn next_indexed(&self) -> IndexedID<E>
下一次分配时, 返回下一个可用的索引
pub fn free_indexed(&mut self, indexed: usize) -> Option<E>
pub fn free_ptr(&mut self, ptr: PtrID<E>) -> Option<E>
pub fn free_if(&mut self, pred: impl Fn(&E, PtrID<E>, IndexedID<E>) -> bool)
pub fn fully_free_if( &mut self, pred: impl Fn(&E, PtrID<E>, IndexedID<E>) -> bool, consume: impl FnMut(E), )
pub fn len(&self) -> usize
pub fn capacity(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn clear(&mut self)
pub fn iter(&self) -> EntityAllocReadIter<'_, E> ⓘ
pub fn iter_mut(&mut self) -> EntityAllocEditIter<'_, E> ⓘ
Trait Implementations§
Source§impl<'alloc, E: IEntityAllocatable> IntoIterator for &'alloc EntityAlloc<E>
impl<'alloc, E: IEntityAllocatable> IntoIterator for &'alloc EntityAlloc<E>
Source§impl<'alloc, E: IEntityAllocatable> IntoIterator for &'alloc mut EntityAlloc<E>
impl<'alloc, E: IEntityAllocatable> IntoIterator for &'alloc mut EntityAlloc<E>
Source§type Item = (usize, <E as IEntityAllocatable>::PtrID, &'alloc mut E)
type Item = (usize, <E as IEntityAllocatable>::PtrID, &'alloc mut E)
The type of the elements being iterated over.
Source§type IntoIter = EntityAllocEditIter<'alloc, E>
type IntoIter = EntityAllocEditIter<'alloc, E>
Which kind of iterator are we turning this into?
Source§impl<E: IEntityAllocatable> IntoIterator for EntityAlloc<E>
impl<E: IEntityAllocatable> IntoIterator for EntityAlloc<E>
Auto Trait Implementations§
impl<E> !Freeze for EntityAlloc<E>
impl<E> !RefUnwindSafe for EntityAlloc<E>
impl<E> Send for EntityAlloc<E>where
<<E as IEntityAllocatable>::AllocatePolicyT as IEntityAllocPolicy<E>>::BitAllocT: Send,
<<E as IEntityAllocatable>::AllocatePolicyT as IEntityAllocPolicy<E>>::Units: Send,
impl<E> !Sync for EntityAlloc<E>
impl<E> Unpin for EntityAlloc<E>
impl<E> UnwindSafe for EntityAlloc<E>where
<<E as IEntityAllocatable>::AllocatePolicyT as IEntityAllocPolicy<E>>::BitAllocT: UnwindSafe,
<<E as IEntityAllocatable>::AllocatePolicyT as IEntityAllocPolicy<E>>::Units: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more