Struct optimistic_lock_coupling::OptimisticLockCoupling[][src]

pub struct OptimisticLockCoupling<T: ?Sized> { /* fields omitted */ }

Our data structure, the usage is ‘pretty much’ same as RwLock

Implementations

impl<T> OptimisticLockCoupling<T>[src]

pub fn new(t: T) -> Self[src]

create an instance of OLC

pub fn read_txn<F, R>(&self, logic: F) -> OptimisticLockCouplingResult<R> where
    F: FnMut(&OptimisticLockCouplingReadGuard<'_, T>) -> OptimisticLockCouplingResult<R>, 
[src]

read transaction logic should be an inlined closure

impl<T: ?Sized> OptimisticLockCoupling<T>[src]

pub fn make_outdate(&self)[src]

make self outdate usually used when the container grows and this pointer point to this structure is replaced

pub fn is_poisoned(&self) -> bool[src]

is writter thread dead? if fail then fail ~ no need extra sync

pub fn read(
    &self
) -> OptimisticLockCouplingResult<OptimisticLockCouplingReadGuard<'_, T>>
[src]

I suggest you redo the hole function when error occurs Or just use read_txn

pub fn write(
    &self
) -> OptimisticLockCouplingResult<OptimisticLockCouplingWriteGuard<'_, T>>
[src]

get your RAII write guard

Trait Implementations

impl<T: ?Sized + Default> Default for OptimisticLockCoupling<T>[src]

impl<T: Sized> From<T> for OptimisticLockCoupling<T>[src]

impl<T: ?Sized + Send> Send for OptimisticLockCoupling<T>[src]

Of course Lock could be Send

impl<T: ?Sized + Send + Sync> Sync for OptimisticLockCoupling<T>[src]

Of course Lock could be Sync

Auto Trait Implementations

impl<T> !RefUnwindSafe for OptimisticLockCoupling<T>

impl<T: ?Sized> Unpin for OptimisticLockCoupling<T> where
    T: Unpin

impl<T: ?Sized> UnwindSafe for OptimisticLockCoupling<T> 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<!> for T[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.