pub struct MapRefMut<'a, T> { /* private fields */ }
Expand description
Mutable reference container for Persist
returned by Entities::borrow_mut()
This struct is required to contain a hidden borrow to the requested Persist
.
The reason for this is so we can borrow multiple Persist
, but not break the
borrow checker rules for borrows on a single Persist
.
Methods from Deref<Target = Persist<T>>§
pub fn is_empty(&self) -> bool
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clear the storage out while keeping allocated memory
Should not ever panic
pub fn get(&self, index: usize) -> Option<&T>
pub fn get_mut(&mut self, index: usize) -> Option<&mut T>
Sourcepub fn is_index_live(&self, index: usize) -> bool
pub fn is_index_live(&self, index: usize) -> bool
Check if there is a value at this index
Sourcepub fn push(&mut self, value: T) -> Option<usize>
pub fn push(&mut self, value: T) -> Option<usize>
Push T
on to storage.
A push is not guaranteed to push in any
particular order if the internal storage has empty locations (typical after
many remove
). For this reason it will return the index pushed to.
Returns None
if there are no free slots left
Sourcepub fn insert(&mut self, index: usize, value: T) -> Option<T>
pub fn insert(&mut self, index: usize, value: T) -> Option<T>
Insert T
at location. Returns existing value in that location or None
.
§Panics
Will panic is the index is out of range
Sourcepub fn remove(&mut self, index: usize) -> Option<T>
pub fn remove(&mut self, index: usize) -> Option<T>
Remove the item at this index and return it if it exists. Does not shift elements after it to the left.