pub enum Entry<'a, K, V, Codec = Default> {
Occupied(OccupiedEntry<'a, K, V, Codec>),
Vacant(VacantEntry<'a, K, V, Codec>),
}Expand description
A view into a single entry in an observable hash map, which may either be vacant or occupied.
This is returned by ObservableHashMap::entry.
Variants
Occupied(OccupiedEntry<'a, K, V, Codec>)
An occupied entry.
Vacant(VacantEntry<'a, K, V, Codec>)
A vacant entry.
Implementations
sourceimpl<'a, K, V, Codec> Entry<'a, K, V, Codec> where
K: Clone + RemoteSend,
V: Clone + RemoteSend,
Codec: Codec,
impl<'a, K, V, Codec> Entry<'a, K, V, Codec> where
K: Clone + RemoteSend,
V: Clone + RemoteSend,
Codec: Codec,
sourcepub fn or_insert(self, default: V) -> RefMut<'a, K, V, Codec>
pub fn or_insert(self, default: V) -> RefMut<'a, K, V, Codec>
Ensures a value is in the entry by inserting the default if empty, and returns a mutable reference to the value in the entry.
sourcepub fn or_insert_with<F: FnOnce() -> V>(
self,
default: F
) -> RefMut<'a, K, V, Codec>
pub fn or_insert_with<F: FnOnce() -> V>(
self,
default: F
) -> RefMut<'a, K, V, Codec>
Ensures a value is in the entry by inserting the result of the default function if empty, and returns a mutable reference to the value in the entry.
sourcepub fn or_insert_with_key<F: FnOnce(&K) -> V>(
self,
default: F
) -> RefMut<'a, K, V, Codec>
pub fn or_insert_with_key<F: FnOnce(&K) -> V>(
self,
default: F
) -> RefMut<'a, K, V, Codec>
Ensures a value is in the entry by inserting the result of the default function with key as argument if empty, and returns a mutable reference to the value in the entry.
sourcepub fn and_modify<F: FnOnce(&mut V)>(self, f: F) -> Self
pub fn and_modify<F: FnOnce(&mut V)>(self, f: F) -> Self
Provides in-place mutable access to an occupied entry before any potential inserts into the map.
sourceimpl<'a, K, V, Codec> Entry<'a, K, V, Codec> where
K: Clone + RemoteSend,
V: Clone + RemoteSend + Default,
Codec: Codec,
impl<'a, K, V, Codec> Entry<'a, K, V, Codec> where
K: Clone + RemoteSend,
V: Clone + RemoteSend + Default,
Codec: Codec,
sourcepub fn or_default(self) -> RefMut<'a, K, V, Codec>
pub fn or_default(self) -> RefMut<'a, K, V, Codec>
Ensures a value is in the entry by inserting the default value if empty, and returns a mutable reference to the value in the entry.
Trait Implementations
Auto Trait Implementations
impl<'a, K, V, Codec = Default> !RefUnwindSafe for Entry<'a, K, V, Codec>
impl<'a, K, V, Codec = Default> !Send for Entry<'a, K, V, Codec>
impl<'a, K, V, Codec = Default> !Sync for Entry<'a, K, V, Codec>
impl<'a, K, V, Codec> Unpin for Entry<'a, K, V, Codec> where
K: Unpin,
impl<'a, K, V, Codec = Default> !UnwindSafe for Entry<'a, K, V, Codec>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more
