EntityAlloc

Struct EntityAlloc 

Source
pub struct EntityAlloc<E, P: IAllocPolicy = AllocPolicy256> { /* private fields */ }

Implementations§

Source§

impl<E, P: IAllocPolicy> EntityAlloc<E, P>

Source

pub fn new() -> Self

Source

pub fn with_capacity(cap: usize) -> Self

Source

pub fn allocate(&self, val: E) -> PtrID<E, P>

Source

pub fn try_allocate(&self, val: E) -> Result<PtrID<E, P>, (BorrowMutError, E)>

Source

pub fn next_indexed(&self) -> IndexedID<E, P>

下一次分配时, 返回下一个可用的索引

Source

pub fn free_indexed(&mut self, indexed: usize) -> Option<E>

Source

pub fn free_ptr(&mut self, ptr: PtrID<E, P>) -> Option<E>

Source

pub fn remake_free_chain(&mut self)

Source§

impl<E, P: IAllocPolicy> EntityAlloc<E, P>

Source

pub fn free_if( &mut self, pred: impl FnMut(&E, PtrID<E, P>, IndexedID<E, P>) -> bool, )

Source

pub fn fully_free_if( &mut self, should_free: impl FnMut(&E, PtrID<E, P>, IndexedID<E, P>) -> bool, consume: impl FnMut(E), )

Source

pub fn len(&self) -> usize

Source

pub fn capacity(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn clear(&mut self)

Source

pub fn iter(&self) -> EntityAllocReadIter<'_, E, P>

Source

pub fn iter_mut(&mut self) -> EntityAllocEditIter<'_, E, P>

Trait Implementations§

Source§

impl<E, P: IAllocPolicy> AsMut<EntityAlloc<E, P>> for EntityAlloc<E, P>

Source§

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>

Source§

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>

Source§

type Item = (usize, PtrID<E, P>, &'alloc E)

The type of the elements being iterated over.
Source§

type IntoIter = EntityAllocReadIter<'alloc, E, P>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'alloc, E, P: IAllocPolicy> IntoIterator for &'alloc mut EntityAlloc<E, P>

Source§

type Item = (usize, PtrID<E, P>, &'alloc mut E)

The type of the elements being iterated over.
Source§

type IntoIter = EntityAllocEditIter<'alloc, E, P>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<E, P: IAllocPolicy> IntoIterator for EntityAlloc<E, P>

Source§

type Item = (usize, E)

The type of the elements being iterated over.
Source§

type IntoIter = EntityAllocConsumeIter<E, P>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

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>
where <P as IAllocPolicy>::BitAlloc: Send, <P as IAllocPolicy>::Units<E>: Send,

§

impl<E, P = AllocPolicy256> !Sync for EntityAlloc<E, P>

§

impl<E, P> Unpin for EntityAlloc<E, P>
where <P as IAllocPolicy>::BitAlloc: Unpin,

§

impl<E, P> UnwindSafe for EntityAlloc<E, P>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.