Added no_space parameter for units

This commit is contained in:
2023-06-13 09:13:24 -07:00
parent 088853014e
commit a6bcbd5f66
4 changed files with 53 additions and 10 deletions

View File

@ -29,7 +29,11 @@ impl ToString for Quantity {
let u = self.unit.to_string();
if self.is_one() { return u; };
return format!("{n} {u}");
if self.unit.no_space() {
return format!("{n}{u}");
} else {
return format!("{n} {u}");
}
}
}
@ -39,7 +43,11 @@ impl Quantity {
if self.unitless() { return n; }
let u = self.unit.to_string();
return format!("{n} {u}");
if self.unit.no_space() {
return format!("{n}{u}");
} else {
return format!("{n} {u}");
}
}
pub fn new_float(f: f64) -> Option<Quantity> {