pub struct Entry<'a, K: Eq + Hash + Clone, V> {
pub key: K,
pub value: &'a mut Option<V>,
/* private fields */
}Expand description
An RAII guard providing exclusive access to a key-value pair in the LockMap.
When dropped, this type automatically unlocks the entry allowing other threads to access it.
§Type Parameters
'a- Lifetime of theLockMapK- Key type that must implementEq + Hash + CloneV- Value type
§Examples
use lockmap::LockMap;
let map = LockMap::new();
{
// Get exclusive access to an entry
let mut entry = map.entry("key");
// Modify the value
entry.value.replace(42);
// Entry is automatically unlocked when dropped
}Fields§
§key: K§value: &'a mut Option<V>Trait Implementations§
Auto Trait Implementations§
impl<'a, K, V> Freeze for Entry<'a, K, V>where
K: Freeze,
impl<'a, K, V> RefUnwindSafe for Entry<'a, K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<'a, K, V> Send for Entry<'a, K, V>
impl<'a, K, V> Sync for Entry<'a, K, V>
impl<'a, K, V> Unpin for Entry<'a, K, V>where
K: Unpin,
impl<'a, K, V> !UnwindSafe for Entry<'a, K, 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