hashbrown only.Expand description
Macros for initializing hashbrown maps and sets.
§Example
use map_macro::hashbrown::hash_map;
let hello = hash_map! {
"en" => "Hello",
"de" => "Hallo",
"fr" => "Bonjour",
"es" => "Hola",
"cat" => "Hola",
"🌍" => "👋",
};§Supported Versions of hashbrown
As of writing this, up to the current hashbrown version 0.14 all
versions of hashbrown are supported.
So you can use the macros from this module with any version of hashbrown
to date.
Though highly likely, compatibility can’t be guaranteed with future versions
of hashbrown that break SemVer compatibility
with 0.14.
If hashbrown were to remove the FromIterator
implementations of HashMap and HashSet in a release that is
incompatible with 0.14 (i.e. 0.15 or 1.0) compatibility with the
macros from this module would break for that new version.
Note: to be compatible with all versions of hashbrown at once, this
crate doesn’t re-export hashbrown.
That means that (I) you need to specify it as a dependency yourself and
(II) you can’t rename it or the macros from this module won’t be able to
import the needed types, resulting in a compile-time error.
Macros§
- hash_
map - Macro for creating a
HashMap. - hash_
map_ e - Explicitly typed equivalent of
hash_map!. - hash_
set - Macro for creating a
HashSet. - hash_
set_ e - Explicitly typed equivalent of
hash_set!.