dimensioned 0.2.1

Compile-time type checking of arbitrary unit systems.
docs.rs failed to build dimensioned-0.2.1
Please check build logs and if you believe this is docs.rs' fault, report into this issue report.

===== Dimensioned =====

crates.io Build Status

Dimensioned is a library for compile-time type checking of arbitrary unit systems.

To use, place in Cargo.toml:

  dimensioned = "*"

Note, though, that it is currently going through volatile changes and will stabilize sometime in the future.

Dimensioned now has a convenient macro for creating a unit system. Here is an example of its use (from examples/vec.rs):

make_units! {
    SI, One;
    base {
        Meter, meter, m;
        Kilogram, kilogram, kg;
        Second, second, s;
        Ampere, ampere, A;
        Kelvin, kelvin, K;
        Candela, candela, cd;
        Mole, mole, mol;
    derived {

The first line inside the macro, SI, One; is the name of your unit system followed by the highest allowed root that you want in Peano number form. Generally, you want this to be One, but for CGS units, for example, the square root of base units is allowed, so it should be Two. The numbers One through Ten are defined in the library; if for some reason you need something higher, you can use the syntax

type Eleven = Succ<Ten>;

Then, the block base {} designates the base units of the system. They are given in the form Type, constant, print_form; so that the first line, Meter, meter, m; will define the type Meter, the constant meter which is equal to 1f64 m, and when printed will have the m token.

The derived {} block is for derived units. It is not yet implemented, and is only there to ensure future compatibility.

Dimensioned has its own (under construction) website, available here. It is also on Crates.io.