pub enum EmaInit {
FirstSample,
Sma,
}Expand description
How an Ema produces its first value.
The recurrence alpha * src + (1 - alpha) * prev with alpha = 2/(len+1) is the same in both
modes; only the value it starts from differs, and with it how long the series carries the
influence of that start. At len == 1 (alpha == 1) both modes produce the same values.
Variants§
FirstSample
Seeds with the input value itself and emits from the first sample on. The default, and the historical behaviour of this type.
Sma
Seeds with the SMA of the first len samples and emits from the len-th sample on.
Earlier samples produce no value — a partially accumulated average is not an EMA.
Trait Implementations§
impl Copy for EmaInit
Source§impl<'de> Deserialize<'de> for EmaInit
impl<'de> Deserialize<'de> for EmaInit
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for EmaInit
impl StructuralPartialEq for EmaInit
Auto Trait Implementations§
impl Freeze for EmaInit
impl RefUnwindSafe for EmaInit
impl Send for EmaInit
impl Sync for EmaInit
impl Unpin for EmaInit
impl UnsafeUnpin for EmaInit
impl UnwindSafe for EmaInit
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