pub struct DenseHandleMap<T> { /* private fields */ }Implementations§
Source§impl<T> DenseHandleMap<T>
impl<T> DenseHandleMap<T>
pub const fn new() -> Self
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the total number of elements the map can hold without reallocating.
Sourcepub fn get(&self, handle: Handle<T>) -> Option<&T>
pub fn get(&self, handle: Handle<T>) -> Option<&T>
Returns a reference to the value associated with handle.
Returns None if the value does not exist.
Sourcepub fn get_mut(&mut self, handle: Handle<T>) -> Option<&mut T>
pub fn get_mut(&mut self, handle: Handle<T>) -> Option<&mut T>
Returns a mutable reference to the value associated with handle.
Returns None if the value does not exist.
Sourcepub fn predict_next_handle(&self) -> Handle<T>
pub fn predict_next_handle(&self) -> Handle<T>
Predicts the next handle that will be generated.
This is just an alias for predict_handle(0).
§Panics
This function will panic if the predicted capacity exceeds u32::MAX
Sourcepub fn predict_handle(&self, count: usize) -> Handle<T>
pub fn predict_handle(&self, count: usize) -> Handle<T>
Predicts the handle that will be generated after inserting count values.
This is only accurate for multiple inserts. Once a single removal is made, this prediction can de-sync.
§Panics
This function will panic if the predicted capacity exceeds u32::MAX
Sourcepub fn remove(&mut self, handle: Handle<T>) -> Option<T>
pub fn remove(&mut self, handle: Handle<T>) -> Option<T>
Removes the value associated with handle from the map.
Returns None if the value does not exist.
Sourcepub fn iter(&self) -> Iter<'_, T> ⓘ
pub fn iter(&self) -> Iter<'_, T> ⓘ
Returns an iterator that yields all value refrences in the map and their associated Handle.
Sourcepub fn iter_mut(&mut self) -> IterMut<'_, T> ⓘ
pub fn iter_mut(&mut self) -> IterMut<'_, T> ⓘ
Returns an iterator that yields all mutable value refrences in the map and their associated Handle.
Sourcepub fn handles(&self) -> Handles<'_, T> ⓘ
pub fn handles(&self) -> Handles<'_, T> ⓘ
Returns an iterator that yields every valid value Handle in the map.
Sourcepub fn values(&self) -> Values<'_, T> ⓘ
pub fn values(&self) -> Values<'_, T> ⓘ
Returns an iterator that yields all value refrences in the map.
Sourcepub fn values_mut(&mut self) -> ValuesMut<'_, T> ⓘ
pub fn values_mut(&mut self) -> ValuesMut<'_, T> ⓘ
Returns an iterator that yields all mutable value refrences in the map.
Trait Implementations§
Source§impl<T: Clone> Clone for DenseHandleMap<T>
impl<T: Clone> Clone for DenseHandleMap<T>
Source§fn clone(&self) -> DenseHandleMap<T>
fn clone(&self) -> DenseHandleMap<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more