pub enum Entry<'a, I, K, V> {
Occupied(OccupiedEntry<'a, I, K, V>),
Vacant(VacantEntry<'a, I, K, V>),
}Variants§
Occupied(OccupiedEntry<'a, I, K, V>)
Vacant(VacantEntry<'a, I, K, V>)
Implementations§
Source§impl<'a, I: EntityId, K, V> Entry<'a, I, K, V>
impl<'a, I: EntityId, K, V> Entry<'a, I, K, V>
pub fn index(&self) -> I
Sourcepub fn insert_entry(self, value: V) -> OccupiedEntry<'a, I, K, V>
pub fn insert_entry(self, value: V) -> OccupiedEntry<'a, I, K, V>
Sets the value of the entry (after inserting if vacant), and returns an OccupiedEntry.
If the entry is already occupied, the old value will be discarded.
Sourcepub fn or_insert(self, default: V) -> &'a mut V
pub fn or_insert(self, default: V) -> &'a mut V
Inserts the given default value in the entry if it is vacant and returns a mutable reference to it. Otherwise a mutable reference to an already existent value is returned.
Sourcepub fn or_insert_with<F>(self, f: F) -> &'a mut Vwhere
F: FnOnce() -> V,
pub fn or_insert_with<F>(self, f: F) -> &'a mut Vwhere
F: FnOnce() -> V,
Like or_insert, but allows constructing the default value lazily.
Sourcepub fn or_insert_with_key<F>(self, f: F) -> &'a mut V
pub fn or_insert_with_key<F>(self, f: F) -> &'a mut V
Like or_insert_with, but also provides a reference to the key.
pub fn key(&self) -> &K
Sourcepub fn and_modify<F>(self, f: F) -> Self
pub fn and_modify<F>(self, f: F) -> Self
Modifies the entry if it is occupied.
Sourcepub fn or_default(self) -> &'a mut Vwhere
V: Default,
pub fn or_default(self) -> &'a mut Vwhere
V: Default,
Inserts a default-constructed value in the entry if it is vacant and returns a mutable reference to it. Otherwise a mutable reference to an already existent value is returned.
Auto Trait Implementations§
impl<'a, I, K, V> !UnwindSafe for Entry<'a, I, K, V>
impl<'a, I, K, V> Freeze for Entry<'a, I, K, V>where
K: Freeze,
impl<'a, I, K, V> RefUnwindSafe for Entry<'a, I, K, V>
impl<'a, I, K, V> Send for Entry<'a, I, K, V>
impl<'a, I, K, V> Sync for Entry<'a, I, K, V>
impl<'a, I, K, V> Unpin for Entry<'a, I, K, V>
impl<'a, I, K, V> UnsafeUnpin for Entry<'a, I, K, V>where
K: UnsafeUnpin,
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