[−][src]Struct rw_lease::RWLease
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]
A: AtomicInt,
A::Prim: AddSign,
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]
A: AtomicInt,
A::Prim: AddSign,
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,
T: Send,
impl<T, A = AtomicUsize> !Sync for RWLease<T, A>
impl<T, A> Unpin for RWLease<T, A> where
A: Unpin,
T: Unpin,
A: Unpin,
T: Unpin,
impl<T, A> UnwindSafe for RWLease<T, A> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,