ResamplingFunction

Enum ResamplingFunction 

Source
pub enum ResamplingFunction<T: Div<Output = T> + Sum + Default + Debug, S: Sample<Value = T>> {
    Average,
    Sum,
    Max,
    Min,
    First,
    Last,
    Coalesce,
    Count,
    Custom(Box<dyn ClonableFnMut<S, T>>),
}
Expand description

The ResamplingFunction enum represents the different resampling functions that can be used to resample a channel.

Variants§

§

Average

Calculates the average of all samples in the time step (ignoring None values)

§

Sum

Calculates the sum of all samples in the time step (ignoring None values)

§

Max

Calculates the maximum value of all samples in the time step (ignoring None values)

§

Min

Calculates the minimum value of all samples in the time step (ignoring None values)

§

First

Uses the first sample in the time step. If the first sample is None, the resampling function will return None.

§

Last

Uses the last sample in the time step. If the last sample is None, the resampling function will return None.

§

Coalesce

Returns the first non-None sample in the time step. If all samples are None, the resampling function will return None.

§

Count

Counts the number of samples in the time step (ignoring None values)

§

Custom(Box<dyn ClonableFnMut<S, T>>)

A custom resampling function that takes a closure that takes a slice of samples and returns an optional value.

Implementations§

Source§

impl<T: Div<Output = T> + Sum + PartialOrd + FromPrimitive + Default + Debug, S: Sample<Value = T>> ResamplingFunction<T, S>

Source

pub fn apply(&mut self, samples: &[&S]) -> Option<T>

Trait Implementations§

Source§

impl<T, S> Clone for ResamplingFunction<T, S>
where T: Div<Output = T> + Sum + Default + Debug, S: Sample<Value = T>,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
Source§

impl<T: Div<Output = T> + Sum + Default + Debug, S: Sample<Value = T>> Debug for ResamplingFunction<T, S>

Source§

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

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

impl<T: Div<Output = T> + Sum + Default + Debug, S: Sample<Value = T>> Default for ResamplingFunction<T, S>

Source§

fn default() -> ResamplingFunction<T, S>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<T, S> Freeze for ResamplingFunction<T, S>

§

impl<T, S> !RefUnwindSafe for ResamplingFunction<T, S>

§

impl<T, S> Send for ResamplingFunction<T, S>

§

impl<T, S> Sync for ResamplingFunction<T, S>

§

impl<T, S> Unpin for ResamplingFunction<T, S>

§

impl<T, S> !UnwindSafe for ResamplingFunction<T, S>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

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

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

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

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.