pub struct EntryByRef<'a, 'b, K, Q, V>{
pub key: &'b Q,
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 theLockMap'b- Lifetime of the key referenceK- Key type that must implementEq + Hash + CloneQ- Query type that can be borrowed fromKV- 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: &'b Q§value: &'a mut Option<V>Trait Implementations§
Auto Trait Implementations§
impl<'a, 'b, K, Q, V> Freeze for EntryByRef<'a, 'b, K, Q, V>where
Q: ?Sized,
impl<'a, 'b, K, Q, V> RefUnwindSafe for EntryByRef<'a, 'b, K, Q, V>
impl<'a, 'b, K, Q, V> Send for EntryByRef<'a, 'b, K, Q, V>
impl<'a, 'b, K, Q, V> Sync for EntryByRef<'a, 'b, K, Q, V>
impl<'a, 'b, K, Q, V> Unpin for EntryByRef<'a, 'b, K, Q, V>where
Q: ?Sized,
impl<'a, 'b, K, Q, V> !UnwindSafe for EntryByRef<'a, 'b, K, Q, 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