pub enum Entry<'a, T> {
Occupied(OccupiedEntry<'a, T>),
Vacant(VacantEntry<'a, T>),
}
Expand description
A view into a single entry in a map, which may either be vacant or occupied.
Variants§
Occupied(OccupiedEntry<'a, T>)
Vacant(VacantEntry<'a, T>)
Implementations§
Source§impl<'a, T: 'static> Entry<'a, T>
impl<'a, T: 'static> Entry<'a, T>
Sourcepub fn or_insert(self, default: T) -> &'a mut T
pub fn or_insert(self, default: T) -> &'a mut T
Ensures a value is in the entry by inserting the default if empty, and returns a mutable reference to the value in the entry.
Sourcepub fn or_insert_with<F: FnOnce() -> T>(self, default: F) -> &'a mut T
pub fn or_insert_with<F: FnOnce() -> T>(self, default: F) -> &'a mut T
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.
Trait Implementations§
Auto Trait Implementations§
impl<'a, T> Freeze for Entry<'a, T>
impl<'a, T> !RefUnwindSafe for Entry<'a, T>
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>
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