Skip to main content

Entry

Enum Entry 

Source
pub enum Entry<'a, K1, K2, V> {
    Occupied(OccupiedEntry<'a, K1, K2, V>),
    Vacant(VacantEntry<'a, K1, K2, V>),
}
Expand description

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

Variants§

§

Occupied(OccupiedEntry<'a, K1, K2, V>)

Both provided keys identify the same existing entry.

§

Vacant(VacantEntry<'a, K1, K2, V>)

Neither of the provided keys is present — a new entry can be inserted.

Implementations§

Source§

impl<K1, K2, V> Entry<'_, K1, K2, V>

Source

pub fn key1(&self) -> &K1

Returns a reference to the K1 key of this entry.

Source

pub fn key2(&self) -> &K2

Returns a reference to the K2 key of this entry.

Source

pub fn keys(&self) -> (&K1, &K2)

Returns a reference to the keys of type K1 and K2 of this entry.

Source§

impl<'a, K1, K2, V> Entry<'a, K1, K2, V>
where K1: Clone, K2: Clone,

Source

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

Ensures a value is in the entry by inserting default if vacant, and returns a mutable reference to the value.

Source

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

Ensures a value is in the entry by inserting the result of default if vacant, and returns a mutable reference to the value.

Source

pub fn or_insert_with_keys<F>(self, default: F) -> &'a mut V
where F: FnOnce(&K1, &K2) -> V,

Ensures a value is in the entry by inserting the result of default if vacant, and returns a mutable reference to the value. The default closure receives references to the keys of the entry.

Source

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

Provides in-place mutation of an occupied entry before any potential insertion, then returns the entry unchanged for further chaining.

Source

pub fn insert_entry(self, value: V) -> OccupiedEntry<'a, K1, K2, V>

Sets the value of the entry, and returns an OccupiedEntry.

Source

pub fn or_default(self) -> &'a mut V
where V: Default,

Ensures a value is in the entry by inserting the default value if vacant.

Auto Trait Implementations§

§

impl<'a, K1, K2, V> !UnwindSafe for Entry<'a, K1, K2, V>

§

impl<'a, K1, K2, V> Freeze for Entry<'a, K1, K2, V>
where K1: Freeze, K2: Freeze,

§

impl<'a, K1, K2, V> RefUnwindSafe for Entry<'a, K1, K2, V>

§

impl<'a, K1, K2, V> Send for Entry<'a, K1, K2, V>
where K1: Send, K2: Send, V: Send,

§

impl<'a, K1, K2, V> Sync for Entry<'a, K1, K2, V>
where K1: Sync, K2: Sync, V: Sync,

§

impl<'a, K1, K2, V> Unpin for Entry<'a, K1, K2, V>
where K1: Unpin, K2: Unpin,

§

impl<'a, K1, K2, V> UnsafeUnpin for Entry<'a, K1, K2, V>
where K1: UnsafeUnpin, K2: UnsafeUnpin,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more