Skip to main content

Buffer

Trait Buffer 

Source
pub trait Buffer<T> {
    // Required methods
    fn len(&self) -> usize;
    fn as_slice(&self) -> &[T];
    fn as_mut_slice(&mut self) -> &mut [T];
    fn fill(&mut self, value: T)
       where T: Copy;
    fn copy_from(&mut self, src: &[T])
       where T: Copy;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

Common interface for audio buffers of arbitrary size.

Enables storing buffers of different types and sizes in a single graph resource registry (GraphResources).

Required Methods§

Source

fn len(&self) -> usize

Number of samples in the buffer.

Source

fn as_slice(&self) -> &[T]

Read-only access to the buffer data.

Source

fn as_mut_slice(&mut self) -> &mut [T]

Mutable access to the buffer data.

Source

fn fill(&mut self, value: T)
where T: Copy,

Fill the entire buffer with a value.

Source

fn copy_from(&mut self, src: &[T])
where T: Copy,

Copy data from a slice. Copies min(src.len(), self.len()) samples.

Provided Methods§

Source

fn is_empty(&self) -> bool

Whether the buffer is empty.

Implementors§

Source§

impl<T: Transcendental> Buffer<T> for TapeLoop<T>

Source§

impl<T: Default + Copy> Buffer<T> for HeapBuffer<T>

Source§

impl<T: Default + Copy, const SIZE: usize> Buffer<T> for FixedBuffer<T, SIZE>