Enum Ma
pub enum Ma {
Sma(Sma),
Ema(Ema),
}Expand description
A moving average — either SMA or EMA — with a uniform interface.
Variants§
Implementations§
§impl Ma
impl Ma
pub fn new(ma_type: MaType, period: usize) -> Result<Self, InvalidPeriod>
pub fn new(ma_type: MaType, period: usize) -> Result<Self, InvalidPeriod>
Construct the appropriate variant for the given type and period.
Returns Err(InvalidPeriod) if period is zero.
pub fn push(&mut self, price: Price)
pub fn is_ready(&self) -> bool
pub fn value(&self) -> Option<Price>
pub fn count(&self) -> usize
pub fn period(&self) -> usize
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Ma
impl RefUnwindSafe for Ma
impl Send for Ma
impl Sync for Ma
impl Unpin for Ma
impl UnsafeUnpin for Ma
impl UnwindSafe for Ma
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)