Implement Ord, PartialOrd, Eq, PartialEq by hand

There is a bug in rustc that causes code explosion when auto-implementing PartialOrd.  https://github.com/rust-lang/rust/issues/15375

Until those issues are fixed, I've implemented them by hand.