Replies: 1 comment
-
Maybe you're looking for this // Add missing imports.
mod custom_milli {
ISQ!(
uom::si,
f32,
(millimeter /* Now its base number is millimeter */, gram, second, ampere, kelvin, mole, candela)
);
}
#[derive(Serialize, Deserialize, Debug)]
struct Unit {
// Update to use a Length based on milimeter
length: custom_milli::Length,
}
// All copied pasted from your's comment here below
fn main() {
let data = r#"
{
"length": 0.4
}"#;
let v: Unit = serde_json::from_str(data).unwrap();
dbg!(v);
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Upon deserialization, how do I specify
Length
to be in millimeter? That is, 0.4mm rather than 0.4mBeta Was this translation helpful? Give feedback.
All reactions