Crate hash_that_set

source ·
Expand description

This crate is dedicated to the sole purpose of hashing collections of elements in an iteration order-independent fashion. For example, it can be used to hash a HashMap or HashSet.

Documentation referring to a “collection” means any type C where &C: IntoIterator

Structs

  • Adds hashing to any collection according to the hash of each element, but without respecting iteration order. Instantly usable with HashMap or HashSet. Deref and DerefMut provide access to the wrapped type. To create, use the new method or From.
  • Adds hashing to any collection according to the hash of each element, but without respecting iteration order. Always usable with any collection, via the default hasher. Deref and DerefMut provide access to the wrapped type.
  • Implementation of BuildHasherFromFriend which uses the default hasher, always
  • Implementation of BuildHasherFromFriend which requires that the peer provides the hasher, i.e. that ProvidesHasher is implemented for the peer object

Traits

  • Like the standard library’s BuildHasher, but takes the hashing implementation from a peer
  • Trait for types which provide a hashing implementation. This is automatically implemented for HashMap and HashSet. It allows the wrapper SumHashes to use the same hashing implementation for elements as is used for the whole hash result.

Functions

  • Implements hashing by summing the hashes of each element. A new DefaultHasher is created for each element, its result added to the total calculation.
  • The main function implementing hashing by summing the hashes of each element, with a means of specifying which kind of hasher is created per element via the BH parameter.