We have T: Hash + Eq
Furthermore, we want to be able to maintain a set and do u64 -> T
and T -> u64
.
One way to do this is
pub struct Foo {
a: HashMap<u64, T>,
b: HashMap<T, u64>,
}
However, this requires storing every T
twice. Is there a way to do this while storing each T
only once ?