Due to the differences between PhfBorrow and Borrow, the following code compiles only for HashMap and not phf::Map:
fn test(key: &str) {
let map: HashMap<MyStruct, u32> = HashMap::new();
let phf_map: phf::Map<MyStruct, u32> = phf::Map::new();
let key = MyStruct { key };
map.get(&key);
phf_map.get(&key); // <- fails to compile
}
Here is a RustExplorer link that shows the example & compiler error in more detail.
The docs state that I can manually implement the requisite borrow pattern for my type. So I was wondering if anyone would be able to provide an example impl of PhfBorrow that would result in the code compiling or point me in the right direction for further reading on this topic?