mirror of
https://github.com/rm-dr/daisy
synced 2025-07-01 14:43:30 -07:00
Cleanup, added to_string_outer
This commit is contained in:
@ -36,6 +36,16 @@ impl ToString for Quantity {
|
||||
}
|
||||
|
||||
impl Quantity {
|
||||
pub fn to_string_outer(&self) -> String {
|
||||
let n = self.v.to_string();
|
||||
if self.unitless() { return n; }
|
||||
|
||||
let u = self.u.to_string();
|
||||
return format!("{n} {u}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
pub fn new_float(f: f64) -> Option<Quantity> {
|
||||
let v = Scalar::new_float(f);
|
||||
if v.is_none() { return None; }
|
||||
|
Reference in New Issue
Block a user