this crate provides a simple physical unit system for Rust:
It is very simple and unfortunately doesn’t scale since every unit (and combination of units) needs to be defined.
There are a bunch of macros to make it easier but it’s still very hacky.
But for simple units it works quite nicely:
let length = Meter(20.72); let time = Second(12.39); // Resulting type: MeterPerSecond let velocity = length / time; // This will not compile: // let error = length + time;