Struct tc_transact::lock::TxnLock [−][src]
pub struct TxnLock<T> { /* fields omitted */ }
Expand description
A lock which provides transaction-specific versions of the locked state.
Implementations
Try to acquire a read lock synchronously.
pub fn read<'a>(&self, txn_id: &'a TxnId) -> TxnLockReadFuture<'a, T>ⓘNotable traits for TxnLockReadFuture<'a, T>impl<'a, T: Clone> Future for TxnLockReadFuture<'a, T> type Output = TCResult<TxnLockReadGuard<T>>;
pub fn read<'a>(&self, txn_id: &'a TxnId) -> TxnLockReadFuture<'a, T>ⓘNotable traits for TxnLockReadFuture<'a, T>impl<'a, T: Clone> Future for TxnLockReadFuture<'a, T> type Output = TCResult<TxnLockReadGuard<T>>;
Notable traits for TxnLockReadFuture<'a, T>
impl<'a, T: Clone> Future for TxnLockReadFuture<'a, T> type Output = TCResult<TxnLockReadGuard<T>>;
Lock this state for reading at the given TxnId
.
Try to acquire a write lock, synchronously.
pub fn write(&self, txn_id: TxnId) -> TxnLockWriteFuture<T>ⓘNotable traits for TxnLockWriteFuture<T>impl<T: Clone> Future for TxnLockWriteFuture<T> type Output = TCResult<TxnLockWriteGuard<T>>;
pub fn write(&self, txn_id: TxnId) -> TxnLockWriteFuture<T>ⓘNotable traits for TxnLockWriteFuture<T>impl<T: Clone> Future for TxnLockWriteFuture<T> type Output = TCResult<TxnLockWriteGuard<T>>;
Notable traits for TxnLockWriteFuture<T>
impl<T: Clone> Future for TxnLockWriteFuture<T> type Output = TCResult<TxnLockWriteGuard<T>>;
Lock this state for writing at the given TxnId
.
Trait Implementations
Commit this transaction.
Auto Trait Implementations
impl<T> RefUnwindSafe for TxnLock<T>
impl<T> UnwindSafe for TxnLock<T>
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn cast_into(self) -> F
pub fn can_cast_from(&F) -> bool
pub fn can_cast_from(&F) -> bool
Test if value
can be cast into Self
.
pub fn opt_cast_from(f: F) -> Option<T>
pub fn opt_cast_from(f: F) -> Option<T>
Returns Some(Self)
if the source value can be cast into Self
, otherwise None
.
fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err> where
OnErr: FnOnce(&T) -> Err,
fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err> where
OnErr: FnOnce(&T) -> Err,
Returns Ok(Self)
if the source value can be cast into Self
, otherwise calls on_err
.
pub fn can_cast_into(&self) -> bool
pub fn can_cast_into(&self) -> bool
Test if self
can be cast into T
.
pub fn opt_cast_into(self) -> Option<T>
pub fn opt_cast_into(self) -> Option<T>
Returns Some(T)
if self
can be cast into T
, otherwise None
.
fn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err> where
OnErr: FnOnce(&Self) -> Err,
fn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err> where
OnErr: FnOnce(&Self) -> Err,
Returns Ok(T)
if self
can be cast into T
, otherwise calls on_err
.