pub mod length_si {
    use serde::{Deserialize, Deserializer, Serializer};
    use uom::si::f64::Length;
    use uom::si::length::meter;

    pub fn serialize<S: Serializer>(value: &Length, s: S) -> Result<S::Ok, S::Error> {
        s.serialize_f64(value.get::<meter>())
    }

    pub fn deserialize<'de, D: Deserializer<'de>>(d: D) -> Result<Length, D::Error> {
        f64::deserialize(d).map(Length::new::<meter>)
    }
}

pub mod angle_si {
    use serde::{Deserialize, Deserializer, Serializer};
    use uom::si::angle::radian;
    use uom::si::f64::Angle;

    pub fn serialize<S: Serializer>(value: &Angle, s: S) -> Result<S::Ok, S::Error> {
        s.serialize_f64(value.get::<radian>())
    }

    pub fn deserialize<'de, D: Deserializer<'de>>(d: D) -> Result<Angle, D::Error> {
        f64::deserialize(d).map(Angle::new::<radian>)
    }
}
