pub enum FrequencyLimit {
    All,
    Min(f32),
    Max(f32),
    Range(f32, f32),
}
Expand description

Can be used to specify a desired frequency limit. If you know that you only need frequencies f <= 1000Hz, 1000 <= f <= 6777, or 10000 <= f, then this can help you to accelerate overall computation speed and memory usage.

Please note that due to frequency inaccuracies the FFT result may not contain a value for 1000Hz but for 998.76Hz!

Variants§

§

All

Interested in all frequencies. [0, sampling_rate/2] (Nyquist theorem). Semantically equivalent to “None” limit at all).

§

Min(f32)

Only interested in frequencies Frequency <= x. Limit is inclusive. Supported values are 0 <= x <= Nyquist-Frequency.

§

Max(f32)

Only interested in frequencies x <= Frequency. Limit is inclusive. Supported values are 0 <= x <= N.

§

Range(f32, f32)

Only interested in frequencies 1000 <= f <= 6777 for example. Both values are inclusive. The first value of the tuple is equivalent to FrequencyLimit::Min and the latter equivalent to FrequencyLimit::Max. Furthermore, the first value must not be bigger than the second value.

Implementations§

source§

impl FrequencyLimit

source

pub const fn maybe_min(&self) -> Option<f32>

Returns the minimum value, if any.

source

pub const fn maybe_max(&self) -> Option<f32>

Returns the maximum value, if any.

source

pub fn min(&self) -> f32

Returns the minimum value, panics if it’s none. Unwrapped version of Self::maybe_min.

source

pub fn max(&self) -> f32

Returns the minimum value, panics if it’s none. Unwrapped version of Self::maybe_max.

source

pub fn verify( &self, max_detectable_frequency: f32 ) -> Result<(), FrequencyLimitError>

Verifies that the frequency limit has sane values and takes the maximum possible frequency into account.

Trait Implementations§

source§

impl Clone for FrequencyLimit

source§

fn clone(&self) -> FrequencyLimit

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for FrequencyLimit

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Copy for FrequencyLimit

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.