Crate hashable[][src]

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);

Structs

HashableHashMap

A HashMap wrapper that implements Hash by sorting pre-hashed entries and feeding those back into the passed-in Hasher.

HashableHashSet

A HashSet wrapper that implements Hash by sorting pre-hashed entries and feeding those back into the passed-in Hasher.