Expand description
More collection types.
§Small* collections
Built on top of the excellent smallvec
crate, SmallMap and SmallSet are a Map and Set respectively that
are inlined if they contain fewer values than a (statically chosen)
capacity C, otherwise they are heap allocated and backed by an
IndexMap.
§VecMap
See vec_map for more details.
§Multimap
A collection that maps keys to values, similar to HashMap, but where
each key may be associated with multiple values. Multimaps can be
visualized as a map from keys to non-empty collections of values:
- a → 0, 1
- b → 2
Or, it can be visualized as a collection of key-value pairs:
- a → 0
- a → 1
- b → 2
The multimap API is based on the second form, len() == 3 and keys_len() == 2 for the above example.
| Name | Behaves as | Keys order | Values order | May contain duplicates |
|---|---|---|---|---|
HashSetMultimap | HashMap<K,HashSet<V>> | Arbitrary order | Arbitrary order | No |
HashVecMultimap | HashMap<K,Vec<V>> | Arbitrary order | Insertion order1 | Yes |
IndexSetMultimap | IndexMap<K,IndexSet<V>> | Insertion order1 | Insertion order1 | No |
IndexVecMultimap | IndexMap<K, Vec<V>> | Insertion order1 | Insertion order1 | Yes |
§Crate features
All features are disabled by default. The options are:
hashsetmultimaphashvecmultimapindexsetmultimapindexvecmultimap
Re-exports§
pub use small_map::SmallMap;pub use small_set::SmallSet;pub use vec_map::IndexKey;pub use vec_map::VecMap;
Modules§
- hash_
set_ multimap - hash_
vec_ multimap - index_
set_ multimap - index_
vec_ multimap - small_
map - small_
set - vec_map
VecMapis aVec-backed map, for faster random access.
Macros§
- hashsetmultimap
- hashvecmultimap
- indexsetmultimap
- indexvecmultimap
- smallmap
- smallmap_
inline - Creates
SmallMapwith inline capacity equal to the number of values. - smallset
- Create a
SmallSetwith with the specified values. - smallset_
inline - Create a
SmallSetwith inline capacity equal to the number of values. - vecmap
- Create a
VecMapcontaining the arguments.
Structs§
- Hash
SetMultimap - Multimap implementation that behaves like
HashMap<K, HashSet<V>>. - Hash
VecMultimap - Multimap implementation that behaves like
HashMap<K, Vec<V>>. - Index
SetMultimap - Multimap implementation that behaves like
IndexMap<K, IndexSet<V>>. - Index
VecMultimap - Multimap implementation that behaves like
IndexMap<K, Vec<V>>.