pub struct FanInBuffer<T: Transcendental, const N: usize, const PRODUCERS: usize> { /* private fields */ }Expand description
Buffer for mixing multiple producers to one consumer.
Single-threaded — use rill_core::queues for cross-thread.
Implementations§
Source§impl<T: Transcendental, const N: usize, const PRODUCERS: usize> FanInBuffer<T, N, PRODUCERS>
impl<T: Transcendental, const N: usize, const PRODUCERS: usize> FanInBuffer<T, N, PRODUCERS>
Sourcepub fn write(&mut self, producer_id: usize, data: &[T; N])
pub fn write(&mut self, producer_id: usize, data: &[T; N])
Write a block of data from one producer.
Sourcepub fn try_read(&mut self) -> Option<[T; N]>
pub fn try_read(&mut self) -> Option<[T; N]>
Read and sum all producers’ data that have new writes since last read.
Sourcepub const fn producer_count(&self) -> usize
pub const fn producer_count(&self) -> usize
Number of producers (const generic parameter).
Sourcepub fn producer_has_data(&self, producer_id: usize) -> bool
pub fn producer_has_data(&self, producer_id: usize) -> bool
Whether a specific producer has unread data.
Sourcepub fn write_seq(&self, producer_id: usize) -> Option<usize>
pub fn write_seq(&self, producer_id: usize) -> Option<usize>
Write sequence counter for a specific producer, or None if ID is invalid.
Sourcepub fn clear_producer(&mut self, producer_id: usize)
pub fn clear_producer(&mut self, producer_id: usize)
Clear a specific producer’s data without affecting others.
Trait Implementations§
Source§impl<T: Transcendental + Debug, const N: usize, const PRODUCERS: usize> Debug for FanInBuffer<T, N, PRODUCERS>
impl<T: Transcendental + Debug, const N: usize, const PRODUCERS: usize> Debug for FanInBuffer<T, N, PRODUCERS>
Source§impl<T: Transcendental, const N: usize, const PRODUCERS: usize> Default for FanInBuffer<T, N, PRODUCERS>
impl<T: Transcendental, const N: usize, const PRODUCERS: usize> Default for FanInBuffer<T, N, PRODUCERS>
Source§impl<T: Transcendental, const N: usize, const PRODUCERS: usize> SignalBuffer<T> for FanInBuffer<T, N, PRODUCERS>
impl<T: Transcendental, const N: usize, const PRODUCERS: usize> SignalBuffer<T> for FanInBuffer<T, N, PRODUCERS>
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 PRODUCERS: usize> !Freeze for FanInBuffer<T, N, PRODUCERS>
impl<T, const N: usize, const PRODUCERS: usize> RefUnwindSafe for FanInBuffer<T, N, PRODUCERS>where
T: RefUnwindSafe,
impl<T, const N: usize, const PRODUCERS: usize> Send for FanInBuffer<T, N, PRODUCERS>
impl<T, const N: usize, const PRODUCERS: usize> Sync for FanInBuffer<T, N, PRODUCERS>
impl<T, const N: usize, const PRODUCERS: usize> Unpin for FanInBuffer<T, N, PRODUCERS>where
T: Unpin,
impl<T, const N: usize, const PRODUCERS: usize> UnsafeUnpin for FanInBuffer<T, N, PRODUCERS>where
T: UnsafeUnpin,
impl<T, const N: usize, const PRODUCERS: usize> UnwindSafe for FanInBuffer<T, N, PRODUCERS>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