HashMap and HashBrown

Is HashMap implementation in std based on HashBrown and thus there is no need to be explicitly importing that external crate?

The hashmap in the standard library is hashbrown. So unless you need to use features only exposed by the crate (or new features not yet exposed in the std) you don't need the hashbrown crate.

3 Likes

Thank you!

(The implementation for std's HashMap wasn't always hashbrown and may be something else in the future, too. Part of the reason it's not just some re-export is for std to maintain the flexibility to change things in the future. Any API exposed in std must be maintained ~forever.)

4 Likes

Sure, but I see this as a positive. One has "generic" API hidden under std::HashMap and if something changes under the hood one gets the goodies for free.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.