[−][src]Struct spmc_ring::SpmsRing
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]
T: Default + Copy,
N: ArrayLength<T>,
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
Auto Trait Implementations
impl<T, N> RefUnwindSafe for SpmsRing<T, N> where
<N as ArrayLength<T>>::ArrayType: RefUnwindSafe,
<N as ArrayLength<T>>::ArrayType: RefUnwindSafe,
impl<T, N> Send for SpmsRing<T, N> where
T: Send,
T: Send,
impl<T, N> Sync for SpmsRing<T, N> where
T: Sync,
T: Sync,
impl<T, N> Unpin for SpmsRing<T, N> where
<N as ArrayLength<T>>::ArrayType: Unpin,
<N as ArrayLength<T>>::ArrayType: Unpin,
impl<T, N> UnwindSafe for SpmsRing<T, N> where
<N as ArrayLength<T>>::ArrayType: UnwindSafe,
<N as ArrayLength<T>>::ArrayType: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,