[][src]Struct rw_lease::RWLease

pub struct RWLease<T, A = AtomicUsize> where
    A: AtomicInt,
    A::Prim: AddSign
{ /* fields omitted */ }

An RWLock, but:

  • Choose your atomic unsigned integer for storage:
    • We will steal the high bit for the writer.
    • We will count readers on the remaining bits.
  • Bring your own synchronisation primitive:
    • No looping
  • Writers wait for a lack of readers before assuming Write access.

Implementations

impl<T, A> RWLease<T, A> where
    A: AtomicInt,
    A::Prim: AddSign
[src]

pub fn new(value: T) -> RWLease<T, A>[src]

pub fn read(&self) -> Result<ReadGuard<T, A>, Blocked>[src]

Attempt to take a read lease by CAS or explain why we couldn't.

pub fn write<'a>(&'a self) -> Result<DrainGuard<'a, T, A>, Blocked>[src]

pub fn into_inner(self) -> T[src]

Trait Implementations

impl<T: Debug, A: Debug> Debug for RWLease<T, A> where
    A: AtomicInt,
    A::Prim: AddSign
[src]

impl<T: Send> Send for RWLease<T>[src]

impl<T: Sync> Sync for RWLease<T>[src]

Auto Trait Implementations

impl<T, A = AtomicUsize> !RefUnwindSafe for RWLease<T, A>

impl<T, A> Send for RWLease<T, A> where
    T: Send

impl<T, A = AtomicUsize> !Sync for RWLease<T, A>

impl<T, A> Unpin for RWLease<T, A> where
    A: Unpin,
    T: Unpin

impl<T, A> UnwindSafe for RWLease<T, A> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.