pub enum Entry<'a, T, Extractor, K, S = DefaultHashBuilder> {
Vacant(VacantEntry<'a, T, Extractor, K, S>),
OccupiedEntry(&'a mut T),
}
Expand description
An entry into a KeyedSet
, allowing in-place modification of the value associated with the key if it exists.
Variants§
Vacant(VacantEntry<'a, T, Extractor, K, S>)
The key was not yet present in the KeyedSet
.
OccupiedEntry(&'a mut T)
The key was already present in the KeyedSet
.
Implementations§
Source§impl<'a, T: 'a, Extractor, S, K> Entry<'a, T, Extractor, K, S>where
S: BuildHasher,
for<'z> Extractor: KeyExtractor<'z, T>,
for<'z, 'b> <Extractor as KeyExtractor<'z, T>>::Key: PartialEq<<Extractor as KeyExtractor<'b, T>>::Key>,
impl<'a, T: 'a, Extractor, S, K> Entry<'a, T, Extractor, K, S>where
S: BuildHasher,
for<'z> Extractor: KeyExtractor<'z, T>,
for<'z, 'b> <Extractor as KeyExtractor<'z, T>>::Key: PartialEq<<Extractor as KeyExtractor<'b, T>>::Key>,
Sourcepub fn get_or_insert_with(self, f: impl FnOnce(K) -> T) -> &'a mut T
pub fn get_or_insert_with(self, f: impl FnOnce(K) -> T) -> &'a mut T
Get a mutable reference to the value if present, or assign a value constructed by f
if it wasn’t.
Sourcepub fn get_or_insert_with_into(self) -> &'a mut Twhere
K: Into<T>,
pub fn get_or_insert_with_into(self) -> &'a mut Twhere
K: Into<T>,
A shortcut for entry.get_or_insert_with(Into::into)
Auto Trait Implementations§
impl<'a, T, Extractor, K, S> Freeze for Entry<'a, T, Extractor, K, S>where
K: Freeze,
impl<'a, T, Extractor, K, S> RefUnwindSafe for Entry<'a, T, Extractor, K, S>
impl<'a, T, Extractor, K, S> Send for Entry<'a, T, Extractor, K, S>
impl<'a, T, Extractor, K, S> Sync for Entry<'a, T, Extractor, K, S>
impl<'a, T, Extractor, K, S> Unpin for Entry<'a, T, Extractor, K, S>where
K: Unpin,
impl<'a, T, Extractor, K, S = BuildHasherDefault<AHasher>> !UnwindSafe for Entry<'a, T, Extractor, K, S>
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