pub struct ExponentialMovingAverage<const FACTOR: usize> { /* private fields */ }Expand description
An exponential moving average calculator.
Based on the formula:
EMA_t = EMA_{t-1} + (Value_t - EMA_{t-1}) / min(t, FACTOR)
this object maintains a running average that emphasizes recent values more heavily and creates a smooth long-tailed averaging effect over time.
Implementations§
Trait Implementations§
Source§impl<const FACTOR: usize> Clone for ExponentialMovingAverage<FACTOR>
impl<const FACTOR: usize> Clone for ExponentialMovingAverage<FACTOR>
Source§fn clone(&self) -> ExponentialMovingAverage<FACTOR>
fn clone(&self) -> ExponentialMovingAverage<FACTOR>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<const FACTOR: usize> Debug for ExponentialMovingAverage<FACTOR>
impl<const FACTOR: usize> Debug for ExponentialMovingAverage<FACTOR>
Source§impl<const FACTOR: usize> Default for ExponentialMovingAverage<FACTOR>
impl<const FACTOR: usize> Default for ExponentialMovingAverage<FACTOR>
Source§fn default() -> ExponentialMovingAverage<FACTOR>
fn default() -> ExponentialMovingAverage<FACTOR>
Returns the “default value” for a type. Read more
Source§impl<const FACTOR: usize> PartialEq for ExponentialMovingAverage<FACTOR>
impl<const FACTOR: usize> PartialEq for ExponentialMovingAverage<FACTOR>
Source§fn eq(&self, other: &ExponentialMovingAverage<FACTOR>) -> bool
fn eq(&self, other: &ExponentialMovingAverage<FACTOR>) -> bool
Tests for
self and other values to be equal, and is used by ==.impl<const FACTOR: usize> Copy for ExponentialMovingAverage<FACTOR>
impl<const FACTOR: usize> StructuralPartialEq for ExponentialMovingAverage<FACTOR>
Auto Trait Implementations§
impl<const FACTOR: usize> Freeze for ExponentialMovingAverage<FACTOR>
impl<const FACTOR: usize> RefUnwindSafe for ExponentialMovingAverage<FACTOR>
impl<const FACTOR: usize> Send for ExponentialMovingAverage<FACTOR>
impl<const FACTOR: usize> Sync for ExponentialMovingAverage<FACTOR>
impl<const FACTOR: usize> Unpin for ExponentialMovingAverage<FACTOR>
impl<const FACTOR: usize> UnwindSafe for ExponentialMovingAverage<FACTOR>
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