[][src]Trait locklessness::handle::Handle

pub unsafe trait Handle: Sized + Clone {
    type HandleInner;
    fn try_allocate_id<IdType>(&self) -> Option<IdType>
    where
        Self::HandleInner: HandleInner<IdType>
;
fn free_id<IdType>(&self, id: IdType)
    where
        Self::HandleInner: HandleInner<IdType>
;
fn with<R, F: FnOnce(&Self::HandleInner) -> R>(&self, f: F) -> R;
fn new(inner: Self::HandleInner) -> Self;
fn id_limit<IdType>(&self) -> usize
    where
        Self::HandleInner: HandleInner<IdType>
; }

This encapsulates the pattern of wrapping a fixed-size lock-free data-structure inside an RwLock, and automatically resizing it when the number of concurrent handles increases.

Associated Types

Loading content...

Required methods

fn try_allocate_id<IdType>(&self) -> Option<IdType> where
    Self::HandleInner: HandleInner<IdType>, 

fn free_id<IdType>(&self, id: IdType) where
    Self::HandleInner: HandleInner<IdType>, 

fn with<R, F: FnOnce(&Self::HandleInner) -> R>(&self, f: F) -> R

fn new(inner: Self::HandleInner) -> Self

fn id_limit<IdType>(&self) -> usize where
    Self::HandleInner: HandleInner<IdType>, 

Loading content...

Implementors

impl<H> Handle for BoundedHandle<H>[src]

type HandleInner = H

impl<H> Handle for ResizingHandle<H>[src]

type HandleInner = H

Loading content...