global: fixes

This commit is contained in:
nym21
2025-09-07 21:55:39 +02:00
parent 10b496e845
commit de98c5f706
5 changed files with 63 additions and 82 deletions
@@ -1,6 +1,7 @@
use std::{
cmp::Ordering,
f64,
iter::Sum,
ops::{Add, AddAssign, Div, Mul},
};
@@ -77,6 +78,13 @@ impl Div<StoredF64> for StoredF64 {
}
}
impl Div<Dollars> for StoredF64 {
type Output = Self;
fn div(self, rhs: Dollars) -> Self::Output {
Self::from(self.0 / *rhs)
}
}
impl Add for StoredF64 {
type Output = Self;
fn add(self, rhs: Self) -> Self::Output {
@@ -161,3 +169,9 @@ impl Printable for StoredF64 {
&["f64"]
}
}
impl Sum for StoredF64 {
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
Self(iter.map(|v| v.0).sum::<f64>())
}
}