Expand description
An unordered multiset/bag implementation backed by HashMap
.
A bag, unlike a set, allows duplicate values, and keeps track of how many
duplicates each value holds. This type of collection is often referred to
as an unordered multiset (see also C++’s std::unordered_multiset
).
This multiset/bag is implemented using a HashMap<T, usize>
and so requires
that the stored type implements Hash + Eq
.
For usage examples, see the primary type HashBag
.
If you want to use a hash table with amortized resizes,
set the amortize
feature.
(De)serialization via serde is also available with the serde
feature.
Deserialization note: if the incoming data contains two instances of T
that are the same, the resulting HashBag
will merge
the counts of those instances.
Structs§
- An draining iterator over the distinct items of a
HashBag
and their occurrence counts. - A hash bag implemented as a
HashMap
where the value isusize
. - An owning iterator over the distinct items of a
HashBag
and their occurrence counts. - An iterator over the items of a
HashBag
. - An iterator over the distinct items of a
HashBag
and their occurrence counts.