Expand description
Compile-time typed units, a thin wrap over uom.
uom provides quantities (length, mass, time, …) whose units are checked
at compile time: Length<f64> multiplied by Time<f64> is a
Velocity<f64>, and you cannot accidentally add a Mass to a Length.
This crate re-exports the whole uom API under uom, plus a set of
f64-backed quantity type aliases and a prelude that brings the common
SI unit markers into scope.
§Examples
use tpt_math_units::prelude::*;
use tpt_math_units::si::length::kilometer;
use tpt_math_units::si::time::second;
let distance = Length::new::<kilometer>(3.0);
let duration = Time::new::<second>(90.0);
let speed = distance / duration;
assert!((speed.get::<tpt_math_units::si::velocity::kilometer_per_hour>() - 120.0).abs() < 1e-9);§no_std
uom is built with its std feature disabled; the f32/f64
transcendental math is provided through uom’s libm backend. The
crate therefore compiles for no_std targets.
Re-exports§
pub use uom;