pub enum Entry<'a, T> {
Vacant(VacantEntry<'a, T>),
Occupied(OccupiedEntry<'a, T>),
}Variants§
Implementations§
Source§impl<'a, T> Entry<'a, T>
impl<'a, T> Entry<'a, T>
Sourcepub fn and_modify(self, f: impl FnOnce(&mut T)) -> Self
pub fn and_modify(self, f: impl FnOnce(&mut T)) -> Self
Provides in-place mutable access to a Some before any potential inserts into the option.
Sourcepub fn insert_entry(self, value: T) -> OccupiedEntry<'a, T>
pub fn insert_entry(self, value: T) -> OccupiedEntry<'a, T>
Sets the value of the option, and returns an OccupiedEntry.
Sourcepub fn or_default(self) -> &'a mut Twhere
T: Default,
pub fn or_default(self) -> &'a mut Twhere
T: Default,
Ensures a value is in the option by inserting the default value if None, and returns a
mutable reference to that (already present or default) value.
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 option by inserting default if None, and returns a mutable
reference to that (already present or default) value.
Sourcepub fn or_insert_with(self, default: impl FnOnce() -> T) -> &'a mut T
pub fn or_insert_with(self, default: impl FnOnce() -> T) -> &'a mut T
Ensures a value is in the option by inserting default() if None, and returns a mutable
reference to that (already present or default()) value.
Auto Trait Implementations§
impl<'a, T> Freeze for Entry<'a, T>
impl<'a, T> RefUnwindSafe for Entry<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for Entry<'a, T>where
T: Send,
impl<'a, T> Sync for Entry<'a, T>where
T: Sync,
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