pub struct AddressableShiftRegister<T: Clone> { /* private fields */ }Expand description
A shift register of capacity stages with random access to every stage.
Implementations§
Source§impl<T: Clone> AddressableShiftRegister<T>
impl<T: Clone> AddressableShiftRegister<T>
Sourcepub fn new(capacity: usize, initial: T) -> Result<Self, ErrorsJSL>
pub fn new(capacity: usize, initial: T) -> Result<Self, ErrorsJSL>
A register of capacity stages (at least 1), every stage holding initial.
pub fn capacity(&self) -> usize
Sourcepub fn push(&mut self, value: T) -> T
pub fn push(&mut self, value: T) -> T
Shifts in value at address 0 and returns the value shifted out of the last stage.
Sourcepub fn get(&self, address: usize) -> Option<&T>
pub fn get(&self, address: usize) -> Option<&T>
The value at address (0 = newest), or None if out of range.
Sourcepub fn set(&mut self, address: usize, value: T) -> Result<(), ErrorsJSL>
pub fn set(&mut self, address: usize, value: T) -> Result<(), ErrorsJSL>
Overwrites the value at address; fails if the address is out of range.
Sourcepub fn taps(&self, addresses: &[usize]) -> Result<Vec<T>, ErrorsJSL>
pub fn taps(&self, addresses: &[usize]) -> Result<Vec<T>, ErrorsJSL>
The values at several addresses (a tapped delay line read). Fails on any bad address.
Trait Implementations§
Source§impl<T: Clone> StreamOperator<T, T> for AddressableShiftRegister<T>
As a stream operator the register is a pure delay: each output is the input from capacity
samples earlier (the initial value for the first capacity outputs).
impl<T: Clone> StreamOperator<T, T> for AddressableShiftRegister<T>
As a stream operator the register is a pure delay: each output is the input from capacity
samples earlier (the initial value for the first capacity outputs).
Source§fn process(&mut self, data_in: &[T]) -> Result<Option<Vec<T>>, ErrorsJSL>
fn process(&mut self, data_in: &[T]) -> Result<Option<Vec<T>>, ErrorsJSL>
Processes a chunk of input data and produces a corresponding chunk of output data. The input and output types can be defined based on the specific requirements of the application, such as audio samples, video frames, or other types of data.
This method is called repeatedly as new data becomes available in the stream.
Source§fn flush(&mut self) -> Result<Option<Vec<T>>, ErrorsJSL>
fn flush(&mut self) -> Result<Option<Vec<T>>, ErrorsJSL>
Flushes any remaining data in the operator’s internal buffers and produces any final output data. This method is typically called at the end of a stream or when the operator needs to be shut down, allowing it to perform any necessary cleanup or final computations before the stream is terminated.
Source§impl<T: Clone> StreamOperatorManagement for AddressableShiftRegister<T>
impl<T: Clone> StreamOperatorManagement for AddressableShiftRegister<T>
impl<T: PartialEq + Clone> StructuralPartialEq for AddressableShiftRegister<T>
Auto Trait Implementations§
impl<T> Freeze for AddressableShiftRegister<T>where
T: Freeze,
impl<T> RefUnwindSafe for AddressableShiftRegister<T>where
T: RefUnwindSafe,
impl<T> Send for AddressableShiftRegister<T>where
T: Send,
impl<T> Sync for AddressableShiftRegister<T>where
T: Sync,
impl<T> Unpin for AddressableShiftRegister<T>where
T: Unpin,
impl<T> UnsafeUnpin for AddressableShiftRegister<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for AddressableShiftRegister<T>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