pub struct FanOutBuffer<T, const N: usize, const CONSUMERS: usize>where
T: Transcendental,{ /* private fields */ }Expand description
Buffer for broadcasting from one producer to multiple consumers.
Single-threaded — use rill_core::queues for cross-thread.
Implementations§
Source§impl<T, const N: usize, const CONSUMERS: usize> FanOutBuffer<T, N, CONSUMERS>where
T: Transcendental,
impl<T, const N: usize, const CONSUMERS: usize> FanOutBuffer<T, N, CONSUMERS>where
T: Transcendental,
Sourcepub fn new() -> FanOutBuffer<T, N, CONSUMERS>
pub fn new() -> FanOutBuffer<T, N, CONSUMERS>
Sourcepub fn try_read(&mut self, consumer_id: usize) -> Option<[T; N]>
pub fn try_read(&mut self, consumer_id: usize) -> Option<[T; N]>
Read data for a specific consumer, returning None if already read or no data available.
Sourcepub fn has_new_data(&self, consumer_id: usize) -> bool
pub fn has_new_data(&self, consumer_id: usize) -> bool
Whether unread data exists for the given consumer.
Sourcepub const fn consumer_count(&self) -> usize
pub const fn consumer_count(&self) -> usize
Number of consumers (const generic parameter).
Sourcepub fn current_version(&self) -> usize
pub fn current_version(&self) -> usize
Current write version.
Sourcepub fn last_read_version(&self, consumer_id: usize) -> Option<usize>
pub fn last_read_version(&self, consumer_id: usize) -> Option<usize>
Version last read by a consumer, or None if consumer ID is invalid.
Trait Implementations§
Source§impl<T, const N: usize, const CONSUMERS: usize> Debug for FanOutBuffer<T, N, CONSUMERS>where
T: Transcendental + Debug,
impl<T, const N: usize, const CONSUMERS: usize> Debug for FanOutBuffer<T, N, CONSUMERS>where
T: Transcendental + Debug,
Source§impl<T, const N: usize, const CONSUMERS: usize> Default for FanOutBuffer<T, N, CONSUMERS>where
T: Transcendental,
impl<T, const N: usize, const CONSUMERS: usize> Default for FanOutBuffer<T, N, CONSUMERS>where
T: Transcendental,
Source§fn default() -> FanOutBuffer<T, N, CONSUMERS>
fn default() -> FanOutBuffer<T, N, CONSUMERS>
Returns the “default value” for a type. Read more
Source§impl<T, const N: usize, const CONSUMERS: usize> SignalBuffer<T> for FanOutBuffer<T, N, CONSUMERS>where
T: Transcendental,
impl<T, const N: usize, const CONSUMERS: usize> SignalBuffer<T> for FanOutBuffer<T, N, CONSUMERS>where
T: Transcendental,
Source§fn stats(&self) -> BufferStats
fn stats(&self) -> BufferStats
Get a snapshot of current buffer statistics
Source§fn reset_stats(&mut self)
fn reset_stats(&mut self)
Reset all statistics to zero Read more
Auto Trait Implementations§
impl<T, const N: usize, const CONSUMERS: usize> !Freeze for FanOutBuffer<T, N, CONSUMERS>
impl<T, const N: usize, const CONSUMERS: usize> RefUnwindSafe for FanOutBuffer<T, N, CONSUMERS>where
T: RefUnwindSafe,
impl<T, const N: usize, const CONSUMERS: usize> Send for FanOutBuffer<T, N, CONSUMERS>
impl<T, const N: usize, const CONSUMERS: usize> Sync for FanOutBuffer<T, N, CONSUMERS>
impl<T, const N: usize, const CONSUMERS: usize> Unpin for FanOutBuffer<T, N, CONSUMERS>where
T: Unpin,
impl<T, const N: usize, const CONSUMERS: usize> UnsafeUnpin for FanOutBuffer<T, N, CONSUMERS>where
T: UnsafeUnpin,
impl<T, const N: usize, const CONSUMERS: usize> UnwindSafe for FanOutBuffer<T, N, CONSUMERS>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more