[][src]Struct spmc_ring::SpmsRing

pub struct SpmsRing<T, N: ArrayLength<T>> { /* fields omitted */ }

This is a ring-buffer queue that is intended to be used for pub-sub applications. That is, a single producer writes items to the circular queue, and multiple consumers can read items from the queue. When a write to the fixed-size circular buffer overflows, the oldest items in the queue are overwritten. It is up to the readers to keep track of which items they have already read and poll for the next available item.

Implementations

impl<T, N> SpmsRing<T, N> where
    T: Default + Copy,
    N: ArrayLength<T>, 
[src]

pub fn publish(&mut self, val: &T)[src]

Publish a single item

pub fn read_next(&self, token: &mut ReadToken) -> Result<T, ()>[src]

Read an item from the queue Returns either an available msg or WouldBlock

pub fn empty(&self) -> bool[src]

Is the queue empty?

pub fn available(&self) -> usize[src]

How many total items are available to read?

Trait Implementations

impl<T, N> Default for SpmsRing<T, N> where
    T: Default + Copy,
    N: ArrayLength<T>, 
[src]

Auto Trait Implementations

impl<T, N> RefUnwindSafe for SpmsRing<T, N> where
    <N as ArrayLength<T>>::ArrayType: RefUnwindSafe

impl<T, N> Send for SpmsRing<T, N> where
    T: Send

impl<T, N> Sync for SpmsRing<T, N> where
    T: Sync

impl<T, N> Unpin for SpmsRing<T, N> where
    <N as ArrayLength<T>>::ArrayType: Unpin

impl<T, N> UnwindSafe for SpmsRing<T, N> where
    <N as ArrayLength<T>>::ArrayType: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.