Struct stim::Transaction[src]
pub struct Transaction { // some fields omitted }
Transaction context
Represents a transaction in progress on the current task.
The only way to acquire a reference to a transaction is with
the atomically
function.
Methods
impl Transaction
fn borrow<'a, T: Send + Clone>(&'a self, var: &Var<T>) -> Borrow<'a, T>
Borrow transaction variable
Borrows an immutable reference to the value of a transaction variable.
Failure
Fails if the variable is already borrowed mutably by the current task
fn borrow_mut<'a, T: Send + Clone>(&'a self, var: &Var<T>) -> MutBorrow<'a, T>
Mutably borrow transaction variable
Borrows a mutable reference to the value of a transaction variable.
Failure
Fails if the variable is already borrowed mutably or immutably by the current task.
fn get<T: Send + Clone>(&self, var: &Var<T>) -> T
Read variable
Returns a copy of the value of a transaction variable.
Failure
Fails if the variable is borrowed mutably by the current task.
fn set<T: Send + Clone>(&self, var: &Var<T>, val: T)
Write variable
Sets the value of a transaction variable.
Failure
Fails if the variable is borrowed by the current task.
fn abort(&self) -> !
Abort transaction
Immediately aborts and restarts the current transaction.
fn verify(&self)
Verify transaction consistency
Verifies that the current transaction is still consistent -- that is, that it can still commit successfully. If it is not, the transaction is immediately aborted and restarted.