pub enum Entry<'a, K: 'a, V: 'a + WeakElement> {
Occupied(OccupiedEntry<'a, K, V>),
Vacant(VacantEntry<'a, K, V>),
}
Expand description
Represents an entry in the table which may be occupied or vacant.
Variants§
Occupied(OccupiedEntry<'a, K, V>)
Vacant(VacantEntry<'a, K, V>)
Implementations§
Source§impl<'a, K, V: WeakElement> Entry<'a, K, V>
impl<'a, K, V: WeakElement> Entry<'a, K, V>
Sourcepub fn or_insert(self, default: V::Strong) -> V::Strong
pub fn or_insert(self, default: V::Strong) -> V::Strong
Ensures a value is in the entry by inserting a default value if empty.
O(1) time
Sourcepub fn or_insert_with<F: FnOnce() -> V::Strong>(self, default: F) -> V::Strong
pub fn or_insert_with<F: FnOnce() -> V::Strong>(self, default: F) -> V::Strong
Ensures a value is in the entry by inserting the result of the default function if empty.
O(1) time
Trait Implementations§
Auto Trait Implementations§
impl<'a, K, V> Freeze for Entry<'a, K, V>
impl<'a, K, V> RefUnwindSafe for Entry<'a, K, V>
impl<'a, K, V> Send for Entry<'a, K, V>
impl<'a, K, V> Sync for Entry<'a, K, V>
impl<'a, K, V> Unpin for Entry<'a, K, V>
impl<'a, K, V> !UnwindSafe for Entry<'a, K, V>
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