pub struct PipeBuffer<T, const N: usize>where
T: Transcendental,{ /* private fields */ }Expand description
Single-producer, single-consumer buffer for intra-graph node connections.
Unlike its name suggests, this is not thread-safe — it is used
exclusively within the single-threaded signal graph. For cross-thread
communication use rill_core::queues.
Implementations§
Source§impl<T, const N: usize> PipeBuffer<T, N>where
T: Transcendental,
impl<T, const N: usize> PipeBuffer<T, N>where
T: Transcendental,
Sourcepub fn new() -> PipeBuffer<T, N>
pub fn new() -> PipeBuffer<T, N>
Create a new empty pipe buffer.
Sourcepub fn write(&mut self, data: &[T; N])
pub fn write(&mut self, data: &[T; N])
Write a block of data. Subsequent reads will return this data.
Sourcepub fn try_read(&mut self) -> Option<[T; N]>
pub fn try_read(&mut self) -> Option<[T; N]>
Read the latest written data (destructive — clears the valid flag).
Sourcepub fn read_blocking(&mut self) -> [T; N]
pub fn read_blocking(&mut self) -> [T; N]
Busy-wait until data is available, then read destructively.
Sourcepub fn is_caught_up(&self) -> bool
pub fn is_caught_up(&self) -> bool
Whether all writes have been consumed by reads.
Sourcepub fn overwrites(&self) -> usize
pub fn overwrites(&self) -> usize
Number of times the buffer was overwritten before being read.
Trait Implementations§
Source§impl<T, const N: usize> Buffer<T> for PipeBuffer<T, N>where
T: Transcendental,
impl<T, const N: usize> Buffer<T> for PipeBuffer<T, N>where
T: Transcendental,
Source§fn as_mut_slice(&mut self) -> &mut [T]
fn as_mut_slice(&mut self) -> &mut [T]
Mutable access to the buffer data.
Source§fn copy_from(&mut self, src: &[T])
fn copy_from(&mut self, src: &[T])
Copy data from a slice. Copies
min(src.len(), self.len()) samples.Source§fn stats(&self) -> BufferStats
fn stats(&self) -> BufferStats
Snapshot of performance statistics.
Source§fn reset_stats(&mut self)
fn reset_stats(&mut self)
Reset performance counters (not the data).
Source§impl<T, const N: usize> Clone for PipeBuffer<T, N>where
T: Transcendental + Copy,
impl<T, const N: usize> Clone for PipeBuffer<T, N>where
T: Transcendental + Copy,
Source§fn clone(&self) -> PipeBuffer<T, N>
fn clone(&self) -> PipeBuffer<T, N>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T, const N: usize> Debug for PipeBuffer<T, N>where
T: Transcendental + Debug,
impl<T, const N: usize> Debug for PipeBuffer<T, N>where
T: Transcendental + Debug,
Source§impl<T, const N: usize> Default for PipeBuffer<T, N>where
T: Transcendental,
impl<T, const N: usize> Default for PipeBuffer<T, N>where
T: Transcendental,
Source§fn default() -> PipeBuffer<T, N>
fn default() -> PipeBuffer<T, N>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<T, const N: usize> !Freeze for PipeBuffer<T, N>
impl<T, const N: usize> RefUnwindSafe for PipeBuffer<T, N>where
T: RefUnwindSafe,
impl<T, const N: usize> Send for PipeBuffer<T, N>
impl<T, const N: usize> Sync for PipeBuffer<T, N>
impl<T, const N: usize> Unpin for PipeBuffer<T, N>where
T: Unpin,
impl<T, const N: usize> UnsafeUnpin for PipeBuffer<T, N>where
T: UnsafeUnpin,
impl<T, const N: usize> UnwindSafe for PipeBuffer<T, N>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