Enum Entry

Source
pub enum Entry<'a, T: ?Sized + GetEntry<'a>> {
    Occupied(T::Occupied),
    Vacant(T::Vacant),
}
Expand description

An entry at a given key.

Variants§

§

Occupied(T::Occupied)

An entry with a value.

§

Vacant(T::Vacant)

An entry without a value.

Implementations§

Source§

impl<'a, T: ?Sized + GetEntry<'a>> Entry<'a, T>

Source

pub fn or_insert(self, default: T::Value) -> &'a mut T::Value

Gets this entry’s value, inserting the given default value if the entry is empty.

Source

pub fn or_insert_with<F: FnOnce() -> T::Value>( self, default: F, ) -> &'a mut T::Value

Similar to or_insert, using a closure to create the value if necessary.

Auto Trait Implementations§

§

impl<'a, T> Freeze for Entry<'a, T>
where <T as GetEntry<'a>>::Occupied: Freeze, <T as GetEntry<'a>>::Vacant: Freeze, T: ?Sized,

§

impl<'a, T> RefUnwindSafe for Entry<'a, T>
where <T as GetEntry<'a>>::Occupied: RefUnwindSafe, <T as GetEntry<'a>>::Vacant: RefUnwindSafe, T: ?Sized,

§

impl<'a, T> Send for Entry<'a, T>
where <T as GetEntry<'a>>::Occupied: Send, <T as GetEntry<'a>>::Vacant: Send, T: ?Sized,

§

impl<'a, T> Sync for Entry<'a, T>
where <T as GetEntry<'a>>::Occupied: Sync, <T as GetEntry<'a>>::Vacant: Sync, T: ?Sized,

§

impl<'a, T> Unpin for Entry<'a, T>
where <T as GetEntry<'a>>::Occupied: Unpin, <T as GetEntry<'a>>::Vacant: Unpin, T: ?Sized,

§

impl<'a, T> UnwindSafe for Entry<'a, T>
where <T as GetEntry<'a>>::Occupied: UnwindSafe, <T as GetEntry<'a>>::Vacant: UnwindSafe, T: ?Sized,

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.