Module map
Expand description
Re-exports of map types and utilities.
This module exports the following types:
HashMapandHashSetfrom the standard library orhashbrowncrate. The “map-hashbrown” feature can be used to force the use ofhashbrown, and is required inno_stdenvironments.IndexMapandIndexSetfrom theindexmapcrate, if the “map-indexmap” feature is enabled.- The previously-listed hash map types prefixed with
Fb. These are type aliases withFixedBytes<N>as the key, andFbBuildHasheras the hasher builder. This hasher is optimized for hashing fixed-size byte arrays, and wraps around the default hasher builder. It performs best when the hasher isfxhash, which is enabled by default with the “map-fxhash” feature. - The previously-listed hash map types prefixed with
Selector,Address, andB256. These useFbBuildHasherwith the respective fixed-size byte array as the key. See the previous point for more information.
Unless specified otherwise, the default hasher builder used by these types is
DefaultHashBuilder. This hasher prioritizes speed over security. Users who require HashDoS
resistance should enable the “rand” feature so that the hasher is initialized using a random
seed.
Note that using the types provided in this module may require using different APIs than the
standard library as they might not be generic over the hasher state, such as using
HashMap::default() instead of HashMap::new().
Modules§
- foldhash
- This crate provides foldhash, a fast, non-cryptographic, minimally DoS-resistant hashing algorithm designed for computational uses such as hashmaps, bloom filters, count sketching, etc.
- hash_
map - A hash map implemented with quadratic probing and SIMD lookup.
- hash_
set - A hash set implemented as a
HashMapwhere the value is(). - indexmap
IndexMapis a hash table where the iteration order of the key-value pairs is independent of the hash values of the keys.- rustc_
hash - A speedy, non-cryptographic hashing algorithm used by
rustc.
Structs§
- Default
Hash Builder - The default
BuildHasherused byHashMapandHashSet. - Default
Hasher - The default
Hasherused byHashMapandHashSet. - FbBuild
Hasher BuildHasheroptimized for hashing fixed-size byte arrays.- FbHasher
Hasheroptimized for hashing fixed-size byte arrays.- FxHasher
- A speedy hash algorithm for use within rustc. The hashmap in liballoc by default uses SipHash which isn’t quite as speedy as we want. In the compiler we’re not really worried about DOS attempts, so we use a fast non-cryptographic hash.
- Occupied
Entry - A view into an occupied entry in a
HashMap. It is part of theEntryenum. - Vacant
Entry - A view into a vacant entry in a
HashMap. It is part of theEntryenum.
Enums§
- Entry
- A view into a single entry in a map, which may either be vacant or occupied.
- Index
Entry - Entry for an existing key-value pair in an
IndexMapor a vacant location to insert one.
Type Aliases§
- Address
Index Map IndexMapoptimized for hashingAddress.- Address
Index Set IndexSetoptimized for hashingAddress.- Address
Map HashMapoptimized for hashingAddress.- Address
Set HashSetoptimized for hashingAddress.- B256
Index Map IndexMapoptimized for hashingB256.- B256
Index Set IndexSetoptimized for hashingB256.- B256Map
HashMapoptimized for hashingB256.- B256Set
HashSetoptimized for hashingB256.- FbIndex
Map IndexMapoptimized for hashing fixed-size byte arrays.- FbIndex
Set IndexSetoptimized for hashing fixed-size byte arrays.- FbMap
HashMapoptimized for hashing fixed-size byte arrays.- FbSet
HashSetoptimized for hashing fixed-size byte arrays.- FxBuild
Hasher - The
FxHasherhasher builder. - HashMap
- A
HashMapusing the default hasher. - HashSet
- A
HashSetusing the default hasher. - Index
Map IndexMapusing the default hasher.- Index
Set IndexSetusing the default hasher.- Selector
Index Map IndexMapoptimized for hashingSelector.- Selector
Index Set IndexSetoptimized for hashingSelector.- Selector
Map HashMapoptimized for hashingSelector.- Selector
Set HashSetoptimized for hashingSelector.