Trait basic_dsp_vector::Buffer
[−]
[src]
pub trait Buffer<S, T> where S: ToSliceMut<T>, T: RealNumber { fn get(&mut self, len: usize) -> S; fn construct_new(&mut self, len: usize) -> S; fn free(&mut self, storage: S); fn alloc_len(&self) -> usize; }
A buffer which can be used by other types. Types will call buffers to create new arrays. A buffer may can implement any buffering strategy.
Required Methods
fn get(&mut self, len: usize) -> S
Asks the buffer for new storage.
len
is the minimum size the storage needs to provide.
S doesn't need to have be initialized with any default value.
fn construct_new(&mut self, len: usize) -> S
Asks the buffer for newly created storage which isn't buffered.
The purpose if this method is to abstract the creation of a certain storage type.
fn free(&mut self, storage: S)
Returns a storage to the buffer. The buffer isn't required to free it and might just reuse the storage.
fn alloc_len(&self) -> usize
Returns the allocated length of all storage within this buffer.
Implementors
impl<T> Buffer<Vec<T>, T> for SingleBuffer<T> where T: RealNumber