Enum weak_table::weak_key_hash_map::Entry
source · [−]pub enum Entry<'a, K: 'a + WeakKey, V: 'a> {
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
sourceimpl<'a, K: WeakKey, V> Entry<'a, K, V>
impl<'a, K: WeakKey, V> Entry<'a, K, V>
sourcepub fn or_insert(self, default: V) -> &'a mut V
pub fn or_insert(self, default: V) -> &'a mut V
Ensures a value is in the entry by inserting a default value if empty, and returns a mutable reference to the value in the entry.
O(1) time
sourcepub fn or_insert_with<F: FnOnce() -> V>(self, default: F) -> &'a mut V
pub fn or_insert_with<F: FnOnce() -> V>(self, default: F) -> &'a mut V
Ensures a value is in the entry by inserting the result of the default function if empty, and returns a mutable reference to the value in the entry.
O(1) time
Trait Implementations
Auto Trait Implementations
impl<'a, K, V> RefUnwindSafe for Entry<'a, K, V> where
K: RefUnwindSafe,
V: RefUnwindSafe,
<K as WeakElement>::Strong: RefUnwindSafe,
impl<'a, K, V> Send for Entry<'a, K, V> where
K: Send,
V: Send,
<K as WeakElement>::Strong: Send,
impl<'a, K, V> Sync for Entry<'a, K, V> where
K: Sync,
V: Sync,
<K as WeakElement>::Strong: Sync,
impl<'a, K, V> Unpin for Entry<'a, K, V> where
<K as WeakElement>::Strong: Unpin,
impl<'a, K, V> !UnwindSafe for Entry<'a, K, V>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more