pub enum Entry<'a, K: DirectKey, V> {
Occupied(OccupiedEntry<'a, K, V>),
Vacant(VacantEntry<'a, K, V>),
}Available on crate feature
concurrent only.Expand description
A page-write-locked view of a key, occupied only by that key itself.
Variants§
Occupied(OccupiedEntry<'a, K, V>)
The requested key is present.
Vacant(VacantEntry<'a, K, V>)
The slot is empty or holds another generation.
Implementations§
Source§impl<'a, K: DirectKey, V> Entry<'a, K, V>
impl<'a, K: DirectKey, V> Entry<'a, K, V>
Sourcepub fn or_insert(self, default: V) -> DirectMapRefMut<'a, K, V>
pub fn or_insert(self, default: V) -> DirectMapRefMut<'a, K, V>
Returns the value, inserting default if this key is absent.
Sourcepub fn or_insert_with(
self,
make: impl FnOnce() -> V,
) -> DirectMapRefMut<'a, K, V>
pub fn or_insert_with( self, make: impl FnOnce() -> V, ) -> DirectMapRefMut<'a, K, V>
Returns the value, calling make under the page write lock only if absent.
A panicking factory leaves the slot unchanged.
Sourcepub fn or_insert_with_key(
self,
make: impl FnOnce(&K) -> V,
) -> DirectMapRefMut<'a, K, V>
pub fn or_insert_with_key( self, make: impl FnOnce(&K) -> V, ) -> DirectMapRefMut<'a, K, V>
Like or_insert_with, passing the query key to make.
Sourcepub fn or_default(self) -> DirectMapRefMut<'a, K, V>where
V: Default,
pub fn or_default(self) -> DirectMapRefMut<'a, K, V>where
V: Default,
Returns the value, inserting its default under the lock if absent.
Sourcepub fn and_modify(self, f: impl FnOnce(&mut V)) -> Self
pub fn and_modify(self, f: impl FnOnce(&mut V)) -> Self
Modifies an occupied value and returns this entry. A panic keeps it occupied.
Auto Trait Implementations§
impl<'a, K, V> !Send for Entry<'a, K, V>
impl<'a, K, V> Forget for Entry<'a, K, V>
impl<'a, K, V> Freeze for Entry<'a, K, V>
impl<'a, K, V> Move for Entry<'a, K, V>
impl<'a, K, V> RefUnwindSafe for Entry<'a, K, V>
impl<'a, K, V> Sync for Entry<'a, K, V>
impl<'a, K, V> Unpin for Entry<'a, K, V>
impl<'a, K, V> UnsafeUnpin for Entry<'a, K, V>
impl<'a, K, V> UnwindSafe for Entry<'a, K, V>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more