Shorthands for defining base units with a single conversion factor to another base unit.
The conversion is done by simply multiplying/dividing the value by the passed factor, which thus has to be defined for all value types this scaled unit is used with.
Note that a generic alias is accepted as scaling factor, which makes it possible to use runtime values as scale factors without writing a custom unit type.
1 // The following three lines define the same unit. Most of the time, the 2 // third syntax is the preferred one because it directly declares a unit 3 // instance. 4 alias ScaledUnit!(Metre, 0.0254, "inch", "in") Inch; 5 alias ScaledUnit!(metre, 0.0254, "inch", "in") Inch; 6 enum inch = scale!(metre, 0.0254, "inch", "in");