Skip to main content

Entry

Enum Entry 

Source
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>

Source

pub fn key(&self) -> &K

The occupied stored key, or the query key for a vacant entry.

Source

pub fn or_insert(self, default: V) -> DirectMapRefMut<'a, K, V>

Returns the value, inserting default if this key is absent.

Source

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.

Source

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.

Source

pub fn or_default(self) -> DirectMapRefMut<'a, K, V>
where V: Default,

Returns the value, inserting its default under the lock if absent.

Source

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>
where OccupiedEntry<'a, K, V>: Freeze, VacantEntry<'a, K, V>: Freeze,

§

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>
where OccupiedEntry<'a, K, V>: Sync, VacantEntry<'a, K, V>: Sync,

§

impl<'a, K, V> Unpin for Entry<'a, K, V>
where OccupiedEntry<'a, K, V>: Unpin, VacantEntry<'a, K, V>: Unpin,

§

impl<'a, K, V> UnsafeUnpin for Entry<'a, K, V>
where OccupiedEntry<'a, K, V>: UnsafeUnpin, VacantEntry<'a, K, V>: UnsafeUnpin,

§

impl<'a, K, V> UnwindSafe for Entry<'a, K, V>
where OccupiedEntry<'a, K, V>: UnwindSafe, VacantEntry<'a, K, V>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.