pub struct FreeHashMap<K: NextKey, T> { /* private fields */ }Expand description
A HashMap that reuses freed IDs for new entries.
Implementations§
Source§impl<K: NextKey, T> FreeHashMap<K, T>
impl<K: NextKey, T> FreeHashMap<K, T>
pub fn new() -> Self
pub fn clear(&mut self)
Sourcepub fn has_value(&self, value: &T) -> boolwhere
T: PartialEq,
pub fn has_value(&self, value: &T) -> boolwhere
T: PartialEq,
Checks if a value exists in the map.
Sourcepub fn get_id(&self, value: &T) -> Option<K>where
T: PartialEq,
pub fn get_id(&self, value: &T) -> Option<K>where
T: PartialEq,
Returns the ID of a given value, if it exists.
pub fn is_empty(&self) -> bool
Sourcepub fn remove(&mut self, id: K) -> Option<T>
pub fn remove(&mut self, id: K) -> Option<T>
Removes the entry with the given ID, if it exists.
pub fn values(&self) -> impl Iterator<Item = &T>
pub fn values_mut(&mut self) -> impl Iterator<Item = &mut T>
pub fn keys(&self) -> impl Iterator<Item = &K>
pub fn iter(&self) -> Iter<'_, K, T> ⓘ
pub fn iter_mut(&mut self) -> IterMut<'_, K, T> ⓘ
Trait Implementations§
Source§impl<K: NextKey, T> Default for FreeHashMap<K, T>
impl<K: NextKey, T> Default for FreeHashMap<K, T>
Source§impl<'a, K: NextKey, T> IntoIterator for &'a FreeHashMap<K, T>
impl<'a, K: NextKey, T> IntoIterator for &'a FreeHashMap<K, T>
Source§impl<'a, K: NextKey, T> IntoIterator for &'a mut FreeHashMap<K, T>
impl<'a, K: NextKey, T> IntoIterator for &'a mut FreeHashMap<K, T>
Source§impl<K: NextKey, T> IntoIterator for FreeHashMap<K, T>
impl<K: NextKey, T> IntoIterator for FreeHashMap<K, T>
Auto Trait Implementations§
impl<K, T> Freeze for FreeHashMap<K, T>where
K: Freeze,
impl<K, T> RefUnwindSafe for FreeHashMap<K, T>where
K: RefUnwindSafe,
T: RefUnwindSafe,
impl<K, T> Send for FreeHashMap<K, T>
impl<K, T> Sync for FreeHashMap<K, T>
impl<K, T> Unpin for FreeHashMap<K, T>
impl<K, T> UnsafeUnpin for FreeHashMap<K, T>where
K: UnsafeUnpin,
impl<K, T> UnwindSafe for FreeHashMap<K, T>where
K: UnwindSafe,
T: UnwindSafe,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more