Open jleibs opened 1 week ago
At a glance, I think that to make this possible, what you need is:
pub struct UninternedString(str);
impl Hash for UninternedString { /* mimic impl Hash for InternedString */ }
impl Borrow<UninternedString> for InternedString
impl AsRef<UninternedString> for &str
(must not be Borrow
since it hashes differently)
In theory if I have a string I should be able to hash it and find the corresponding value in a
BTreeSet<ComponentName>
, however in practice to find the value in the set I have to create a ComponentName which does the interning.