pub enum Entry<'a, T: ?Sized + GetEntry<'a>> {
Occupied(T::Occupied),
Vacant(T::Vacant),
}
Expand description
An entry at a given key.
Variants§
Implementations§
Source§impl<'a, T: ?Sized + GetEntry<'a>> Entry<'a, T>
impl<'a, T: ?Sized + GetEntry<'a>> Entry<'a, T>
Sourcepub fn or_insert(self, default: T::Value) -> &'a mut T::Value
pub fn or_insert(self, default: T::Value) -> &'a mut T::Value
Gets this entry’s value, inserting the given default value if the entry is empty.
Sourcepub fn or_insert_with<F: FnOnce() -> T::Value>(
self,
default: F,
) -> &'a mut T::Value
pub fn or_insert_with<F: FnOnce() -> T::Value>( self, default: F, ) -> &'a mut T::Value
Similar to or_insert
, using a closure to create the value if necessary.
Auto Trait Implementations§
impl<'a, T> Freeze for Entry<'a, T>
impl<'a, T> RefUnwindSafe for Entry<'a, T>where
<T as GetEntry<'a>>::Occupied: RefUnwindSafe,
<T as GetEntry<'a>>::Vacant: RefUnwindSafe,
T: ?Sized,
impl<'a, T> Send for Entry<'a, T>
impl<'a, T> Sync for Entry<'a, T>
impl<'a, T> Unpin for Entry<'a, T>
impl<'a, T> UnwindSafe for Entry<'a, T>where
<T as GetEntry<'a>>::Occupied: UnwindSafe,
<T as GetEntry<'a>>::Vacant: UnwindSafe,
T: ?Sized,
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