pub struct EntryRef<'map, K, V, const N: usize = DEFAULT_PAGE_CAPACITY> { /* private fields */ }Expand description
A read guard for an entry in a BLinkMap.
The guard keeps its leaf read-locked. This makes the returned key and value references stable until the guard is dropped.
§Locking
Drop this guard before calling a map operation that may need the same leaf,
especially BLinkMap::insert, BLinkMap::remove, or
BLinkMap::get_mut. Retaining it can self-deadlock. Holding several entry
guards while acquiring more guards in inconsistent orders can likewise
create a cross-thread lock cycle.
Implementations§
Source§impl<K, V, const N: usize> EntryRef<'_, K, V, N>
impl<K, V, const N: usize> EntryRef<'_, K, V, N>
Sourcepub fn value(&self) -> &V
pub fn value(&self) -> &V
Returns the entry’s immutable value.
Examples found in repository?
examples/basic.rs (line 14)
3fn main() {
4 let map = BLinkMap::<u64, String>::new();
5 map.insert(7, String::from("seven"));
6
7 let set = BLinkSet::<u64>::new();
8 set.insert(7);
9
10 let value = map.get(&7).expect("the example inserted key 7");
11
12 println!(
13 "map[7] = {}, set contains 7 = {}",
14 value.value(),
15 set.contains(&7)
16 );
17}Trait Implementations§
Auto Trait Implementations§
impl<'map, K, V, const N: usize = DEFAULT_PAGE_CAPACITY> !RefUnwindSafe for EntryRef<'map, K, V, N>
impl<'map, K, V, const N: usize = DEFAULT_PAGE_CAPACITY> !Send for EntryRef<'map, K, V, N>
impl<'map, K, V, const N: usize = DEFAULT_PAGE_CAPACITY> !UnwindSafe for EntryRef<'map, K, V, N>
impl<'map, K, V, const N: usize> Freeze for EntryRef<'map, K, V, N>where
ArcRwLockReadGuard<RawRwLock, Node<K, V, N>>: Freeze,
PhantomData<&'map BLinkMap<K, V, N>>: Freeze,
impl<'map, K, V, const N: usize> Sync for EntryRef<'map, K, V, N>where
ArcRwLockReadGuard<RawRwLock, Node<K, V, N>>: Sync,
PhantomData<&'map BLinkMap<K, V, N>>: Sync,
impl<'map, K, V, const N: usize> Unpin for EntryRef<'map, K, V, N>where
ArcRwLockReadGuard<RawRwLock, Node<K, V, N>>: Unpin,
PhantomData<&'map BLinkMap<K, V, N>>: Unpin,
impl<'map, K, V, const N: usize> UnsafeUnpin for EntryRef<'map, K, V, N>where
ArcRwLockReadGuard<RawRwLock, Node<K, V, N>>: UnsafeUnpin,
PhantomData<&'map BLinkMap<K, V, N>>: UnsafeUnpin,
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