pub struct SlotmapEntry<'a, T> { /* private fields */ }Expand description
SlotmapEntry is a reference to an element stored in the slotmap.
The SlotmapEntry is created when the element is accessed in the slotmap. It ensures that the element cannot be removed while there is a thread actively accessing it.
§Note
It is the responsibility of the user to ensure that the SlotmapEntry is dropped prior to removing the element from the slotmap. Failure to do so will result in a deadlock, where the erasing method will wait indefinitely for the SlotmapEntry to be dropped.
§Example
use rust_lockless_slotmap::LocklessSlotmap;
use parking_lot::RawRwLock;
let slotmap: LocklessSlotmap<usize, RawRwLock> = LocklessSlotmap::new();
let ticket = slotmap.insert(42);
{
let entry = slotmap.get(ticket).unwrap();
assert_eq!(*entry, 42);
}Implementations§
Source§impl<'a, T> SlotmapEntry<'a, T>
impl<'a, T> SlotmapEntry<'a, T>
Trait Implementations§
Source§impl<'a, T> Deref for SlotmapEntry<'a, T>
impl<'a, T> Deref for SlotmapEntry<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for SlotmapEntry<'a, T>
impl<'a, T> RefUnwindSafe for SlotmapEntry<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for SlotmapEntry<'a, T>where
T: Sync,
impl<'a, T> Sync for SlotmapEntry<'a, T>where
T: Sync,
impl<'a, T> Unpin for SlotmapEntry<'a, T>
impl<'a, T> UnwindSafe for SlotmapEntry<'a, T>where
T: RefUnwindSafe,
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