|
|
|
|
|
by dathinab
2542 days ago
|
|
HashMap implementation and the hasher used in it are not the same. You can use the std hash map with any hash implementing Hash, and I think you can do so with hashbrown, too. The different is what hasher is used by default if you don't explicitly specify one. Hasher => Takes the key and turns it into a hash (in this case a 64bit hash). HashMap => Takes (key, value) pairs + a hasher and then does "magic" to get a fast lookup based on key+hasher. The "magic" part is what changes. (which include thinks like which datastructures are used to store keys/values, how deletion is handled, how hash collisions are handled, how the given hash is used to lookup keys, etc.). |
|