Entry

Enum Entry 

Source
pub enum Entry<'a, 's, A: Allocator, K: PartialOrd + Debug, V, B: ArrayLength>
where U2: Mul<B>, Prod<U2, B>: ArrayLength, U1: Add<Prod<U2, B>>, Sum<U1, Prod<U2, B>>: ArrayLength,
{ Vacant(VacantEntry<'a, 's, A, K, V, B>), Occupied(OccupiedEntry<'a, 's, A, K, V, B>), }
Expand description

A view into a single entry in a map, which may either be vacant or occupied.

This enum is constructed from the entry method on CompressedBTreeMap.

Variants§

§

Vacant(VacantEntry<'a, 's, A, K, V, B>)

A vacant entry.

§

Occupied(OccupiedEntry<'a, 's, A, K, V, B>)

An occupied entry.

Implementations§

Source§

impl<'a, 's, A: Allocator, K: PartialOrd + Debug, V, B: ArrayLength> Entry<'a, 's, A, K, V, B>
where U2: Mul<B>, Prod<U2, B>: ArrayLength, U1: Add<Prod<U2, B>>, Sum<U1, Prod<U2, B>>: ArrayLength,

Source

pub fn and_modify<F>(self, f: F) -> Self
where F: FnOnce(&mut V),

Provides in-place mutable access to an occupied entry before any potential inserts into the map.

Source

pub fn key(&self) -> &K

Returns a reference to this entry’s key.

Source

pub fn insert(self, v: V) -> AllocResult<Option<V>>

Ensures a value is in the entry by inserting the provided value if empty, and returns the old value if the entry was occupied.

§Errors

Will return Err if the allocation fails.

Source

pub fn unwrap_occupied(self) -> OccupiedEntry<'a, 's, A, K, V, B>

Returns the OccupiedEntry if this entry is occupied, panics otherwise.

Auto Trait Implementations§

§

impl<'a, 's, A, K, V, B> Freeze for Entry<'a, 's, A, K, V, B>
where <UInt<UTerm, B1> as Add<<UInt<UInt<UTerm, B1>, B0> as Mul<B>>::Output>>::Output: Sized, <UInt<UInt<UTerm, B1>, B0> as Mul<B>>::Output: Sized, K: Freeze,

§

impl<'a, 's, A, K, V, B> !RefUnwindSafe for Entry<'a, 's, A, K, V, B>

§

impl<'a, 's, A, K, V, B> !Send for Entry<'a, 's, A, K, V, B>

§

impl<'a, 's, A, K, V, B> !Sync for Entry<'a, 's, A, K, V, B>

§

impl<'a, 's, A, K, V, B> Unpin for Entry<'a, 's, A, K, V, B>
where <UInt<UTerm, B1> as Add<<UInt<UInt<UTerm, B1>, B0> as Mul<B>>::Output>>::Output: Sized, <UInt<UInt<UTerm, B1>, B0> as Mul<B>>::Output: Sized, K: Unpin,

§

impl<'a, 's, A, K, V, B> !UnwindSafe for Entry<'a, 's, A, K, V, B>

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> Same for T

Source§

type Output = T

Should always be Self
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.