pub trait SignalBuffer<T>where
T: Transcendental,{
// Required methods
fn capacity(&self) -> usize;
fn len(&self) -> usize;
fn clear(&mut self);
fn stats(&self) -> BufferStats;
fn reset_stats(&mut self);
// Provided methods
fn is_empty(&self) -> bool { ... }
fn is_full(&self) -> bool { ... }
}Expand description
Common trait for all signal buffers
This trait defines the standard interface that all buffer types implement. It provides methods for querying capacity, current length, and statistics.
§Type Parameters
T: The sample type (must implementTranscendental)
Required Methods§
Sourcefn capacity(&self) -> usize
fn capacity(&self) -> usize
Get the total capacity of the buffer in samples
For block-based buffers, this is the number of samples per block. For ring buffers, this is the total number of samples that can be stored.
Sourcefn len(&self) -> usize
fn len(&self) -> usize
Get the current number of items in the buffer
For PipeBuffer and FanOutBuffer, this is either 0 or 1.
For RingBuffer, this is the number of samples available.
For DelayLine, this is always the maximum delay.
Sourcefn clear(&mut self)
fn clear(&mut self)
Clear all items from the buffer
After calling this, the buffer should be empty. Note that this may not actually zero the memory for performance reasons.
Sourcefn stats(&self) -> BufferStats
fn stats(&self) -> BufferStats
Get a snapshot of current buffer statistics
Sourcefn reset_stats(&mut self)
fn reset_stats(&mut self)
Reset all statistics to zero
This does not clear the buffer contents, only the performance counters.