Crate new_units

source ·
Expand description

Zero-hassle marker unit library. Correct code made easy.

Example

use new_units::*;

struct Inches;
assert_eq!(
    3.of(Inches) * 10.of(Inches),
    30.of(Inches) * 1,
    "The answer isn't `30 Inches²` because this crate is not for units of measure.",
);
assert_eq!(3.of(Inches), 3);

Structs

  • Add a marker to another type, eg Unit<Point3, LastPosition>.

Traits

Type Definitions

  • IndexTo<Cars> indexes Vec<_, Cars>.