valkyrie_std_units/
lib.rs1use std::fmt::Display;
2
3pub struct SIQuantities<T> {
4 pub value: T,
5 pub name: SIUnit,
6}
7
8pub struct SIUnit {
10 pub name: String,
12 pub length: i8,
14 pub mass: i8,
16 pub time: i8,
17 pub current: i8,
19 pub thermodynamic: i8,
21 pub amount: i8,
23 pub luminous: i8,
25}
26
27impl Display for SIUnit {
28 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
29 if !self.name.is_empty() {
30 return f.write_str(&self.name);
31 }
32 write!(
33 f,
34 "({}, {}, {}, {}, {}, {}, {})",
35 self.length,
36 self.mass,
37 self.time,
38 self.current,
39 self.thermodynamic,
40 self.amount,
41 self.luminous,
42 )
43 }
44}