I'm packing a state representation into a u64
, and would like to (re-)implement std::fmt::Debug
for u64
, but am running into the orphan rules cited in E0117
. Neither of the following gets around the first change to the orphan rules linked above:
pub type StateT = u64;
pub use u64 as StateT;
It looks like creating a tuple struct does allow me to implement Debug
:
pub struct StateT(u64);
...but doing so of course requires changing many of lines of code where I create and read states and perform bitwise operations, and the resulting code would be more difficult to read, so I'd like to avoid this option.
My use case is a framework for running one of several heuristic search algorithms on one of several instances of one of several problem domains. I'm writing debug output for an algorithm, and I would like to implement Debug
for each problem domain's state type.