Expand description
This library provides HashMap
and HashSet
replacements that implement the Hash
trait – HashableHashMap
and HashableHashSet
.
§Example
The following is rejected by the compiler:
ⓘ
let mut inner_set = std::collections::HashSet::new();
inner_set.insert("inner value");
let mut outer_set = std::collections::HashSet::new();
outer_set.insert(inner_set);
error[E0277]: the trait bound `HashSet<&str>: Hash` is not satisfied
The error can be resolved by swapping the inner HashSet
with HashableHashSet
:
let mut inner_set = hashable::HashableHashSet::new();
inner_set.insert("inner value");
let mut outer_set = std::collections::HashSet::new();
outer_set.insert(inner_set);