pub struct EntityDenseMap { /* private fields */ }Expand description
A structure to store entities in a dense array.
Implementations§
Source§impl EntityDenseMap
impl EntityDenseMap
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a new EntityDenseMap with the specified initial capacity, ensuring it is a power of two.
Sourcepub fn insert(&mut self, entity: Entity) -> Result<usize, usize>
pub fn insert(&mut self, entity: Entity) -> Result<usize, usize>
Inserts a new entity into the map.
Returns Err(index) if the entity already exists, otherwise Ok(index) with the insertion index.
Sourcepub fn remove(&mut self, entity: Entity) -> Option<usize>
pub fn remove(&mut self, entity: Entity) -> Option<usize>
Removes an entity from the map and returns its index if it was found.
Sourcepub fn contains(&self, entity: Entity) -> bool
pub fn contains(&self, entity: Entity) -> bool
Checks whether the specified entity is present in the map.
Sourcepub fn index_of(&self, entity: Entity) -> Option<usize>
pub fn index_of(&self, entity: Entity) -> Option<usize>
Finds the index of the specified entity in the map.
Sourcepub fn get(&self, index: usize) -> Option<Entity>
pub fn get(&self, index: usize) -> Option<Entity>
Retrieves the entity at the given index if available.
Trait Implementations§
Source§impl Clone for EntityDenseMap
impl Clone for EntityDenseMap
Source§fn clone(&self) -> EntityDenseMap
fn clone(&self) -> EntityDenseMap
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EntityDenseMap
impl Debug for EntityDenseMap
Source§impl Default for EntityDenseMap
impl Default for EntityDenseMap
Source§fn default() -> EntityDenseMap
fn default() -> EntityDenseMap
Returns the “default value” for a type. Read more
Source§impl PartialEq for EntityDenseMap
impl PartialEq for EntityDenseMap
impl Eq for EntityDenseMap
impl StructuralPartialEq for EntityDenseMap
Auto Trait Implementations§
impl Freeze for EntityDenseMap
impl RefUnwindSafe for EntityDenseMap
impl Send for EntityDenseMap
impl Sync for EntityDenseMap
impl Unpin for EntityDenseMap
impl UnwindSafe for EntityDenseMap
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.