pub struct OccupiedEntry<'a, A: Hash + Eq, V: Tagged<A>>(/* private fields */);
Expand description
An entry for a key in a map that has a value.
This type maintains the invariant that, if an OccupiedEntry(map, a)
exists, SocketMap::get(map, a)
is Some(v)
, i.e. the HashMap
that
SocketMap
wraps contains a [MapValue
] whose value
field is
Some(v)
.
Implementations§
Source§impl<'a, K: Eq + Hash + IterShadows, V: Tagged<K>> OccupiedEntry<'a, K, V>
impl<'a, K: Eq + Hash + IterShadows, V: Tagged<K>> OccupiedEntry<'a, K, V>
Sourcepub fn map_mut<R>(&mut self, apply: impl FnOnce(&mut V) -> R) -> R
pub fn map_mut<R>(&mut self, apply: impl FnOnce(&mut V) -> R) -> R
Runs the provided callback on the value referenced by this entry.
Returns the result of the callback.
Sourcepub fn into_map(self) -> &'a mut SocketMap<K, V>
pub fn into_map(self) -> &'a mut SocketMap<K, V>
Extracts the underlying SocketMap
reference backing this entry.
Sourcepub fn remove_from_map(self) -> (V, &'a mut SocketMap<K, V>)
pub fn remove_from_map(self) -> (V, &'a mut SocketMap<K, V>)
Removes the value from the map and returns the value and map.
Trait Implementations§
Auto Trait Implementations§
impl<'a, A, V> Freeze for OccupiedEntry<'a, A, V>where
A: Freeze,
impl<'a, A, V> RefUnwindSafe for OccupiedEntry<'a, A, V>
impl<'a, A, V> Send for OccupiedEntry<'a, A, V>
impl<'a, A, V> Sync for OccupiedEntry<'a, A, V>
impl<'a, A, V> Unpin for OccupiedEntry<'a, A, V>where
A: Unpin,
impl<'a, A, V> !UnwindSafe for OccupiedEntry<'a, A, V>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<CC, BC, Meta> RecvFrameContext<Meta, BC> for CCwhere
Meta: ReceivableFrameMeta<CC, BC>,
impl<CC, BC, Meta> RecvFrameContext<Meta, BC> for CCwhere
Meta: ReceivableFrameMeta<CC, BC>,
Source§impl<CC, BC, Meta> SendFrameContext<BC, Meta> for CCwhere
Meta: SendableFrameMeta<CC, BC>,
impl<CC, BC, Meta> SendFrameContext<BC, Meta> for CCwhere
Meta: SendableFrameMeta<CC, BC>,
Source§fn send_frame<S>(
&mut self,
bindings_ctx: &mut BC,
metadata: Meta,
frame: S,
) -> Result<(), ErrorAndSerializer<SendFrameErrorReason, S>>where
S: Serializer,
<S as Serializer>::Buffer: BufferMut,
fn send_frame<S>(
&mut self,
bindings_ctx: &mut BC,
metadata: Meta,
frame: S,
) -> Result<(), ErrorAndSerializer<SendFrameErrorReason, S>>where
S: Serializer,
<S as Serializer>::Buffer: BufferMut,
Send a frame. Read more
Source§impl<Id, CC, BC> TimerHandler<BC, Id> for CCwhere
BC: TimerBindingsTypes,
Id: HandleableTimer<CC, BC>,
impl<Id, CC, BC> TimerHandler<BC, Id> for CCwhere
BC: TimerBindingsTypes,
Id: HandleableTimer<CC, BC>,
Source§fn handle_timer(
&mut self,
bindings_ctx: &mut BC,
dispatch: Id,
timer: <BC as TimerBindingsTypes>::UniqueTimerId,
)
fn handle_timer( &mut self, bindings_ctx: &mut BC, dispatch: Id, timer: <BC as TimerBindingsTypes>::UniqueTimerId, )
Handle a timer firing. Read more