Skip to main content

HandleMap

Struct HandleMap 

Source
pub struct HandleMap(/* private fields */);
Available on crate feature full only.
Expand description

A map of numeric identifiers to Handles.

Implementations§

Source§

impl HandleMap

Source

pub fn clone(&self, _ebr: &EpochGuard) -> Self

Source

pub fn new() -> Self

Creates an empty HandleMap.

§Examples
let map = HandleMap::new();
Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn close(&self, val: u32, ebr: &EpochGuard) -> Result<()>

Source

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.

Trait Implementations§

Source§

impl Debug for HandleMap

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for HandleMap

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Drop for HandleMap

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl !Freeze for HandleMap

§

impl RefUnwindSafe for HandleMap

§

impl Send for HandleMap

§

impl Sync for HandleMap

§

impl Unpin for HandleMap

§

impl UnsafeUnpin for HandleMap

§

impl UnwindSafe for HandleMap

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = !

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.