pub struct EntityAlloc<E, P: IAllocPolicy = AllocPolicy256> { /* private fields */ }Implementations§
Source§impl<E, P: IAllocPolicy> EntityAlloc<E, P>
impl<E, P: IAllocPolicy> EntityAlloc<E, P>
pub fn new() -> Self
pub fn with_capacity(cap: usize) -> Self
pub fn allocate(&self, val: E) -> PtrID<E, P>
pub fn try_allocate(&self, val: E) -> Result<PtrID<E, P>, (BorrowMutError, E)>
Sourcepub fn next_indexed(&self) -> IndexedID<E, P>
pub fn next_indexed(&self) -> IndexedID<E, P>
下一次分配时, 返回下一个可用的索引
pub fn free_indexed(&mut self, indexed: usize) -> Option<E>
pub fn free_ptr(&mut self, ptr: PtrID<E, P>) -> Option<E>
pub fn remake_free_chain(&mut self)
Source§impl<E, P: IAllocPolicy> EntityAlloc<E, P>
impl<E, P: IAllocPolicy> EntityAlloc<E, P>
pub fn free_if( &mut self, pred: impl FnMut(&E, PtrID<E, P>, IndexedID<E, P>) -> bool, )
pub fn fully_free_if( &mut self, should_free: impl FnMut(&E, PtrID<E, P>, IndexedID<E, P>) -> 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, P> ⓘ
pub fn iter_mut(&mut self) -> EntityAllocEditIter<'_, E, P> ⓘ
Trait Implementations§
Source§impl<E, P: IAllocPolicy> AsMut<EntityAlloc<E, P>> for EntityAlloc<E, P>
impl<E, P: IAllocPolicy> AsMut<EntityAlloc<E, P>> for EntityAlloc<E, P>
Source§fn as_mut(&mut self) -> &mut EntityAlloc<E, P>
fn as_mut(&mut self) -> &mut EntityAlloc<E, P>
Converts this type into a mutable reference of the (usually inferred) input type.
Source§impl<E, P: IAllocPolicy> AsRef<EntityAlloc<E, P>> for EntityAlloc<E, P>
impl<E, P: IAllocPolicy> AsRef<EntityAlloc<E, P>> for EntityAlloc<E, P>
Source§fn as_ref(&self) -> &EntityAlloc<E, P>
fn as_ref(&self) -> &EntityAlloc<E, P>
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl<'alloc, E, P: IAllocPolicy> IntoIterator for &'alloc EntityAlloc<E, P>
impl<'alloc, E, P: IAllocPolicy> IntoIterator for &'alloc EntityAlloc<E, P>
Source§impl<'alloc, E, P: IAllocPolicy> IntoIterator for &'alloc mut EntityAlloc<E, P>
impl<'alloc, E, P: IAllocPolicy> IntoIterator for &'alloc mut EntityAlloc<E, P>
Source§impl<E, P: IAllocPolicy> IntoIterator for EntityAlloc<E, P>
impl<E, P: IAllocPolicy> IntoIterator for EntityAlloc<E, P>
Auto Trait Implementations§
impl<E, P = AllocPolicy256> !Freeze for EntityAlloc<E, P>
impl<E, P = AllocPolicy256> !RefUnwindSafe for EntityAlloc<E, P>
impl<E, P> Send for EntityAlloc<E, P>
impl<E, P = AllocPolicy256> !Sync for EntityAlloc<E, P>
impl<E, P> Unpin for EntityAlloc<E, P>
impl<E, P> UnwindSafe for EntityAlloc<E, P>
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