Trait ScalarOrPair

Source
pub trait ScalarOrPair:
    Clone
    + Default
    + Send
    + Sync {
    type Sample: Float;

    // Required methods
    fn construct(x: Self::Sample, y: Self::Sample) -> Self;
    fn broadcast(&self) -> (Self::Sample, Self::Sample);
    fn filter_pole(
        &self,
        input: Self::Sample,
        current: Self::Sample,
        afactor: Self::Sample,
        rfactor: Self::Sample,
    ) -> Self::Sample;
}
Expand description

Trait for 1-way/2-way distinctions, such as symmetric/asymmetric response times.

Required Associated Types§

Required Methods§

Source

fn construct(x: Self::Sample, y: Self::Sample) -> Self

Construct new item from broadcast pair.

Source

fn broadcast(&self) -> (Self::Sample, Self::Sample)

Return pair, broadcasting scalar into pair if needed.

Source

fn filter_pole( &self, input: Self::Sample, current: Self::Sample, afactor: Self::Sample, rfactor: Self::Sample, ) -> Self::Sample

Symmetric or asymmetric 1-pole filter where factors are derived from the broadcast pair.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T: Float> ScalarOrPair for (T, T)

Source§

type Sample = T

Source§

fn construct(x: Self::Sample, y: Self::Sample) -> Self

Source§

fn broadcast(&self) -> (Self::Sample, Self::Sample)

Source§

fn filter_pole( &self, input: Self::Sample, current: Self::Sample, afactor: Self::Sample, rfactor: Self::Sample, ) -> Self::Sample

Implementors§