pub struct TChan<T> { /* private fields */ }
Expand description
Ubounded queue using a linked list of TVar
s.
This implementation builds up a linked list of TVar
s with a
read and a write pointer. The good thing is that the reads don’t
cause retries in writes, unlike if it was just a single TVar
with one data structure in it. It may also help that it’s more
granular, and Transaction::downcast
will not clone a full
data structure.
Implementations
Trait Implementations
sourceimpl<T> TQueueLike<T> for TChan<T> where
T: Any + Sync + Send + Clone,
impl<T> TQueueLike<T> for TChan<T> where
T: Any + Sync + Send + Clone,
sourcefn read(&self) -> StmResult<T>
fn read(&self) -> StmResult<T>
Pop the head of the queue, or retry until there is an element if it’s empty.
Moves the read TVar
down the list to point at the next item.
[TCons(x, [TCons(y, [TNil])])]
| | |
[ ] [*] [*]
read0 -> read1 write
Auto Trait Implementations
impl<T> !RefUnwindSafe for TChan<T>
impl<T> Send for TChan<T> where
T: Send,
impl<T> Sync for TChan<T> where
T: Sync,
impl<T> Unpin for TChan<T> where
T: Unpin,
impl<T> !UnwindSafe for TChan<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more