You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use uom::si::f32::Length;use uom::si::length::millimeter;use serde::{Serialize,Deserialize};#[derive(Serialize,Deserialize,Debug)]structUnit{// length is in millimeter but the base unit of Length is meterlength:Length,}fnmain(){let data = r#" { "length": 0.4 }"#;let v:Unit = serde_json::from_str(data).unwrap();dbg!(v);}// Output[src/main.rs:26] v = Unit{length:0.4 m^1,}
Upon deserialization, how do I specify Length to be in millimeter? That is, 0.4mm rather than 0.4m
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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