EntityAlloc

Struct EntityAlloc 

Source
pub struct EntityAlloc<E: IEntityAllocatable> { /* private fields */ }

Implementations§

Source§

impl<E: IEntityAllocatable> EntityAlloc<E>

Source

pub fn new() -> Self

Source

pub fn with_capacity(cap: usize) -> Self

Source

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

Source

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

Source

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

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

Source

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

Source

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

Source

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

Source

pub fn fully_free_if( &mut self, pred: impl Fn(&E, PtrID<E>, IndexedID<E>) -> 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>

Source

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

Trait Implementations§

Source§

impl<'alloc, E: IEntityAllocatable> IntoIterator for &'alloc EntityAlloc<E>

Source§

type Item = (usize, <E as IEntityAllocatable>::PtrID, &'alloc E)

The type of the elements being iterated over.
Source§

type IntoIter = EntityAllocReadIter<'alloc, E>

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: IEntityAllocatable> IntoIterator for &'alloc mut EntityAlloc<E>

Source§

type Item = (usize, <E as IEntityAllocatable>::PtrID, &'alloc mut E)

The type of the elements being iterated over.
Source§

type IntoIter = EntityAllocEditIter<'alloc, E>

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: IEntityAllocatable> IntoIterator for EntityAlloc<E>

Source§

type Item = (usize, E)

The type of the elements being iterated over.
Source§

type IntoIter = EntityAllocConsumeIter<E>

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§

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.