struct WeightedAverageBackupAccumulator<W: UnitType> {
primary: WeightedAverageAccumulator<W>,
backup: WeightedAverageAccumulator<W>,
}Expand description
Weighted average accumulator with a backup weighting path for MoneyPerFlow prices.
Fields§
§primary: WeightedAverageAccumulator<W>Primary weighted average path.
backup: WeightedAverageAccumulator<W>Backup weighted average path.
Implementations§
Source§impl<W: UnitType> WeightedAverageBackupAccumulator<W>
impl<W: UnitType> WeightedAverageBackupAccumulator<W>
Sourcefn add(&mut self, value: MoneyPerFlow, weight: W, backup_weight: W)
fn add(&mut self, value: MoneyPerFlow, weight: W, backup_weight: W)
Add a weighted value to the accumulator with a backup weight.
Sourcefn finalise(self) -> Option<MoneyPerFlow>
fn finalise(self) -> Option<MoneyPerFlow>
Solve the weighted average, falling back to backup weights if needed.
Returns None if both denominators are zero (or close to zero).
Trait Implementations§
Source§impl<W: Clone + UnitType> Clone for WeightedAverageBackupAccumulator<W>
impl<W: Clone + UnitType> Clone for WeightedAverageBackupAccumulator<W>
Source§fn clone(&self) -> WeightedAverageBackupAccumulator<W>
fn clone(&self) -> WeightedAverageBackupAccumulator<W>
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<W: UnitType> Default for WeightedAverageBackupAccumulator<W>
impl<W: UnitType> Default for WeightedAverageBackupAccumulator<W>
impl<W: Copy + UnitType> Copy for WeightedAverageBackupAccumulator<W>
Auto Trait Implementations§
impl<W> Freeze for WeightedAverageBackupAccumulator<W>
impl<W> RefUnwindSafe for WeightedAverageBackupAccumulator<W>where
W: RefUnwindSafe,
impl<W> Send for WeightedAverageBackupAccumulator<W>where
W: Send,
impl<W> Sync for WeightedAverageBackupAccumulator<W>where
W: Sync,
impl<W> Unpin for WeightedAverageBackupAccumulator<W>where
W: Unpin,
impl<W> UnwindSafe for WeightedAverageBackupAccumulator<W>where
W: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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