pub struct TVar<T> { /* private fields */ }
Expand description

TVar is our handle to a variable, but reading and writing go through a transaction. It also tracks which threads are waiting on it.

Implementations

Create a new TVar. The initial version is 0, so that if a TVar is created in the middle of a transaction it will not cause any MVCC conflict during the commit.

Read the value of the TVar as a clone, for subsequent modification. Only call this inside atomically.

Read the value of the TVar. Only call this inside atomically.

Replace the value of the TVar. Only call this inside atomically.

Apply an update on the value of the TVar. Only call this inside atomically.

Apply an update on the value of the TVar and return a value. Only call this inside atomically.

Replace the value of the TVar and return the previous value. Only call this inside atomically.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.