Improved unit printing

This commit is contained in:
2023-04-08 20:48:49 -07:00
parent e9d4ec0b12
commit d4b7f5b078
2 changed files with 33 additions and 2 deletions

View File

@ -26,9 +26,11 @@ pub struct Quantity {
impl ToString for Quantity {
fn to_string(&self) -> String {
let mut n = self.v.to_string();
if self.unitless() { return n; }
n.push(' ');
n.push_str(&self.u.to_string());
n
return n;
}
}