Trait TQueueLike

Source
pub trait TQueueLike<T>: Clone + Send {
    // Required methods
    fn read(&self) -> Stm<T>;
    fn write(&self, value: T) -> Stm<()>;
    fn is_empty(&self) -> Stm<bool>;
}
Expand description

Transactional queue-like structure.

This is a common interface between the various implementations in Simon Marlow’s book.

Required Methods§

Source

fn read(&self) -> Stm<T>

Pop the head of the queue, or retry until there is an element if it’s empty.

Source

fn write(&self, value: T) -> Stm<()>

Push to the end of the queue.

Source

fn is_empty(&self) -> Stm<bool>

Check if the queue is empty.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> TQueueLike<T> for TBQueue<T>
where T: Any + Sync + Send + Clone,

Source§

impl<T> TQueueLike<T> for TChan<T>
where T: Any + Sync + Send + Clone,

Source§

impl<T> TQueueLike<T> for TQueue<T>
where T: Any + Sync + Send + Clone,

Source§

impl<T> TQueueLike<T> for TVecDequeue<T>
where T: Any + Sync + Send + Clone,