Struct optimistic_lock_coupling::OptimisticLockCoupling [−][src]
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]
F: FnMut(&OptimisticLockCouplingReadGuard<'_, T>) -> OptimisticLockCouplingResult<R>,
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]
&self
) -> OptimisticLockCouplingResult<OptimisticLockCouplingReadGuard<'_, T>>
I suggest you redo the hole function when error occurs
Or just use read_txn
pub fn write(
&self
) -> OptimisticLockCouplingResult<OptimisticLockCouplingWriteGuard<'_, T>>
[src]
&self
) -> OptimisticLockCouplingResult<OptimisticLockCouplingWriteGuard<'_, T>>
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,
T: Unpin,
impl<T: ?Sized> UnwindSafe for OptimisticLockCoupling<T> 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,
pub fn borrow_mut(&mut self) -> &mut T
[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]
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.
pub 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>,