Skip to main content

RtQueueBase

Trait RtQueueBase 

Source
pub trait RtQueueBase<T>: Send + Sync {
    // Required methods
    fn push(&self, value: T) -> QueueResult<()>;
    fn pop(&self) -> Option<T>;
    fn len(&self) -> usize;
    fn capacity(&self) -> usize;
    fn clear(&self);

    // Provided methods
    fn is_empty(&self) -> bool { ... }
    fn is_full(&self) -> bool { ... }
}
Expand description

Base trait for all real-time safe queues.

Implementations must be:

  • Lock-free (no mutexes)
  • RT-safe (no allocations, no blocking)

Required Methods§

Source

fn push(&self, value: T) -> QueueResult<()>

Push a value into the queue.

§Errors

Returns QueueFull if the queue is at capacity.

Source

fn pop(&self) -> Option<T>

Pop a value from the queue, or None if empty.

Source

fn len(&self) -> usize

Current number of elements in the queue.

Source

fn capacity(&self) -> usize

Maximum capacity of the queue.

Source

fn clear(&self)

Clear all elements from the queue.

Provided Methods§

Source

fn is_empty(&self) -> bool

Return true if the queue is empty.

Source

fn is_full(&self) -> bool

Return true if the queue is full.

Implementors§

Source§

impl<T: Copy + Default + Send + Sync, const CAP: usize> RtQueueBase<T> for SpscQueue<T, CAP>