Skip to main content

Map

Struct Map 

Source
pub struct Map<M, F> {
    pub module: M,
    pub f: F,
}
Expand description

Transform output with a pure function

Fields§

§module: M§f: F

Trait Implementations§

Source§

impl<M, F, U> Module for Map<M, F>
where M: Module, F: Fn(M::Out) -> U + Send,

Source§

type In = <M as Module>::In

Input signal type (e.g., f64 for mono, (f64, f64) for stereo)
Source§

type Out = U

Output signal type
Source§

fn tick(&mut self, input: Self::In) -> Self::Out

Process a single sample, advancing internal state by one time step. Read more
Source§

fn reset(&mut self)

Reset internal state to initial conditions. Read more
Source§

fn set_sample_rate(&mut self, sample_rate: f64)

Notify module of sample rate changes. Read more
Source§

fn process(&mut self, input: &[Self::In], output: &mut [Self::Out])
where Self::In: Clone,

Process a block of samples for efficiency. Read more

Auto Trait Implementations§

§

impl<M, F> Freeze for Map<M, F>
where M: Freeze, F: Freeze,

§

impl<M, F> RefUnwindSafe for Map<M, F>

§

impl<M, F> Send for Map<M, F>
where M: Send, F: Send,

§

impl<M, F> Sync for Map<M, F>
where M: Sync, F: Sync,

§

impl<M, F> Unpin for Map<M, F>
where M: Unpin, F: Unpin,

§

impl<M, F> UnsafeUnpin for Map<M, F>
where M: UnsafeUnpin, F: UnsafeUnpin,

§

impl<M, F> UnwindSafe for Map<M, F>
where M: UnwindSafe, F: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<M> ModuleExt for M
where M: Module,

Source§

fn then<M: Module<In = Self::Out>>(self, next: M) -> Chain<Self, M>

Chain this module with another (sequential composition: >>>)
Source§

fn parallel<M: Module>(self, other: M) -> Parallel<Self, M>

Run two modules in parallel (***)
Source§

fn fanout<M: Module<In = Self::In>>(self, other: M) -> Fanout<Self, M>
where Self::In: Clone,

Split input to two parallel processors (&&&)
Source§

fn map<F, U>(self, f: F) -> Map<Self, F>
where F: Fn(Self::Out) -> U,

Transform output with a pure function
Source§

fn contramap<F, U>(self, f: F) -> Contramap<Self, F, U>
where F: Fn(U) -> Self::In,

Transform input with a pure function
Source§

fn feedback<F>(self, combine: F) -> Feedback<Self, F>
where Self::Out: Default + Clone,

Create a feedback loop with a single-sample unit delay. Read more
Source§

fn first<C>(self) -> First<Self, C>

Apply this module only to the first element of a tuple
Source§

fn second<C>(self) -> Second<Self, C>

Apply this module only to the second element of a tuple
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.