Update for latest rustc

transmute is in ::std::mem
derive PartialEq
Deduplicated code, making State<T> generic
s/to_owned/to_string/