pub struct HandleMap(/* private fields */);full only.Expand description
A map of numeric identifiers to Handles.
Implementations§
Source§impl HandleMap
impl HandleMap
pub fn clone(&self, _ebr: &EpochGuard) -> Self
Sourcepub fn push(&self, handle: Arc<Handle>, ebr: &EpochGuard) -> Result<u32>
pub fn push(&self, handle: Arc<Handle>, ebr: &EpochGuard) -> Result<u32>
Adds the passed handle to the handle map and returns the position it’s placed at.
No guarantees are made on what positions in the map are used.
§Errors
Returns Error::Overflow if there are no more free positions to add
the handle at.
Sourcepub fn transfer(&self, handle: PoppedHandle, ebr: &EpochGuard) -> Result<u32>
pub fn transfer(&self, handle: PoppedHandle, ebr: &EpochGuard) -> Result<u32>
Adds a PoppedHandle to the handle map and returns the position it’s placed at,
without incurring costs of refcount changes.
No guarantees are made on what positions in the map are used.
§Errors
Returns Error::Overflow if there are no more free positions to add
the handle at.
Sourcepub fn get<'ebr>(&self, val: u32, ebr: &'ebr EpochGuard) -> Result<&'ebr Handle>
pub fn get<'ebr>(&self, val: u32, ebr: &'ebr EpochGuard) -> Result<&'ebr Handle>
Returns a reference to the handle at val.
§Errors
Returns Error::InvalidHandle if the handle is not in the map.
Sourcepub fn pop(&self, val: u32, ebr: &EpochGuard) -> Result<PoppedHandle>
pub fn pop(&self, val: u32, ebr: &EpochGuard) -> Result<PoppedHandle>
Removes the handle at val from the HandleMap, returning a PoppedHandle.
The PoppedHandle can either be directly dropped, converted into an [Arc<Handle>]
(incurrent refcount costs) or directly passed to HandleMap::transfer() to add it
to a different handle map without incurrent refcount costs.
§Errors
Returns Error::InvalidHandle if the handle is not in the map.
pub fn close(&self, val: u32, ebr: &EpochGuard) -> Result<()>
Sourcepub fn swap(&self, other: Self) -> Self
pub fn swap(&self, other: Self) -> Self
Swaps self to contain the mappings contained in other, and
returns the mappings originally contained in self.
This will race with any calls on self to pop, push, or get
such that changes may modify either the old or new handle map.
Therefore this method should be avoided when self is shared
between multiple threads and concurrently modified.