drbawb/rust-story — pull request #3 by drbawb (2014-02-20 21:27:32+00:00)
Title: Use tuple structs to enforce type safety of units.

For the basic units of measurement I've codified them as tuple structs.

These tuple structs have an overloaded set of operators ( `+`, `-`, `*`, and `/`).
These operators will work on ANY unit (`rhs`) which can implements the appropriate converter trait.
(`AsGame`, `AsTile`, `AsPixel`)

---

These give much nicer error messages, and now that the traits are working the API is actually rather clean.

---

Other units which require more frequent calculations w/ primitives (e.g: Fps, Frame, Millis, etc.) are still just simple typedefs. I'll probably convert to newtypes them at a later occasion.