pub struct RefCountedHashMap<K, V> { /* private fields */ }
Expand description
A HashMap
which keeps a reference count for each entry.
Implementations§
Source§impl<K: Eq + Hash, V> RefCountedHashMap<K, V>
impl<K: Eq + Hash, V> RefCountedHashMap<K, V>
Sourcepub fn insert_with<O, F: FnOnce() -> (V, O)>(
&mut self,
key: K,
f: F,
) -> InsertResult<O>
pub fn insert_with<O, F: FnOnce() -> (V, O)>( &mut self, key: K, f: F, ) -> InsertResult<O>
Increments the reference count of the entry with the given key.
If the key isn’t in the map, the given function is called to create its associated value.
Sourcepub fn remove(&mut self, key: K) -> RemoveResult<V>
pub fn remove(&mut self, key: K) -> RemoveResult<V>
Decrements the reference count of the entry with the given key.
If the reference count reaches 0, the entry will be removed and its value returned.
Sourcepub fn contains_key(&self, key: &K) -> bool
pub fn contains_key(&self, key: &K) -> bool
Returns true
if the map contains a value for the specified key.
Sourcepub fn get(&self, key: &K) -> Option<&V>
pub fn get(&self, key: &K) -> Option<&V>
Returns a reference to the value corresponding to the key.
Trait Implementations§
Source§impl<K, V> Default for RefCountedHashMap<K, V>
impl<K, V> Default for RefCountedHashMap<K, V>
Source§fn default() -> RefCountedHashMap<K, V>
fn default() -> RefCountedHashMap<K, V>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<K, V> Freeze for RefCountedHashMap<K, V>
impl<K, V> RefUnwindSafe for RefCountedHashMap<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for RefCountedHashMap<K, V>
impl<K, V> Sync for RefCountedHashMap<K, V>
impl<K, V> Unpin for RefCountedHashMap<K, V>
impl<K, V> UnwindSafe for RefCountedHashMap<K, V>where
K: UnwindSafe,
V: UnwindSafe,
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<O, BC> BuildableCoreContext<BC> for Owhere
O: Default,
impl<O, BC> BuildableCoreContext<BC> for Owhere
O: Default,
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