pub struct FnSplitProcess<F>(pub F);Expand description
Wrap a Fn into a SplitProcess/SplitInplace
The closure receives both the mutable split state and the new input sample. This is a compact way to prototype split-state processors before promoting them to named types.
§Examples
use dsp_process::{FnSplitProcess, SplitProcess};
let proc = FnSplitProcess(|state: &mut i32, x: i32| {
*state += x;
*state
});
let mut state = 0;
assert_eq!(proc.process(&mut state, 2), 2);
assert_eq!(proc.process(&mut state, 3), 5);Tuple Fields§
§0: FTrait Implementations§
Source§impl<F, X: Copy, S> SplitInplace<X, S> for FnSplitProcess<F>where
Self: SplitProcess<X, X, S>,
impl<F, X: Copy, S> SplitInplace<X, S> for FnSplitProcess<F>where
Self: SplitProcess<X, X, S>,
Auto Trait Implementations§
impl<F> Freeze for FnSplitProcess<F>where
F: Freeze,
impl<F> RefUnwindSafe for FnSplitProcess<F>where
F: RefUnwindSafe,
impl<F> Send for FnSplitProcess<F>where
F: Send,
impl<F> Sync for FnSplitProcess<F>where
F: Sync,
impl<F> Unpin for FnSplitProcess<F>where
F: Unpin,
impl<F> UnsafeUnpin for FnSplitProcess<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for FnSplitProcess<F>where
F: 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
Source§impl<'a, X, S, T, const L: usize> SplitViewInplace<ViewMut<'a, X, FrameMajor, L>, S> for T
impl<'a, X, S, T, const L: usize> SplitViewInplace<ViewMut<'a, X, FrameMajor, L>, S> for T
Source§fn inplace_view(&self, state: &mut S, xy: ViewMut<'a, X, FrameMajor, L>)
fn inplace_view(&self, state: &mut S, xy: ViewMut<'a, X, FrameMajor, L>)
Process one typed view in place.
Source§impl<'a, 'b, X, Y, S, T, const L: usize> SplitViewProcess<View<'a, X, FrameMajor, L>, ViewMut<'b, Y, FrameMajor, L>, S> for T
impl<'a, 'b, X, Y, S, T, const L: usize> SplitViewProcess<View<'a, X, FrameMajor, L>, ViewMut<'b, Y, FrameMajor, L>, S> for T
Source§fn process_view(
&self,
state: &mut S,
x: View<'a, X, FrameMajor, L>,
y: ViewMut<'b, Y, FrameMajor, L>,
)
fn process_view( &self, state: &mut S, x: View<'a, X, FrameMajor, L>, y: ViewMut<'b, Y, FrameMajor, L>, )
Process one typed input view into one typed output view.