#hasher #hash #hash-map #hash-set

no-std nohash-hasher

An implementation of std::hash::Hasher which does not hash at all

5 releases

0.2.0 Feb 17, 2020
0.1.3 Jan 22, 2020
0.1.2 Sep 20, 2019
0.1.1 Nov 15, 2018
0.1.0 Sep 18, 2018

#1970 in Algorithms

Download history 151645/week @ 2024-03-14 166440/week @ 2024-03-21 170369/week @ 2024-03-28 177620/week @ 2024-04-04 184387/week @ 2024-04-11 177903/week @ 2024-04-18 166281/week @ 2024-04-25 165421/week @ 2024-05-02 161850/week @ 2024-05-09 170293/week @ 2024-05-16 195720/week @ 2024-05-23 204203/week @ 2024-05-30 193389/week @ 2024-06-06 196480/week @ 2024-06-13 181505/week @ 2024-06-20 169126/week @ 2024-06-27

781,382 downloads per month
Used in 1,629 crates (134 directly)

Apache-2.0 OR MIT

15KB
246 lines

NoHashHasher

For an enabled type T, a NoHashHasher<T> implements std::hash::Hasher and uses the value set by one of the write_{u8, u16, u32, u64, usize, i8, i16, i32, i64, isize} methods as its hash output.

NoHashHasher does not implement any hashing algorithm and can only be used with types which can be mapped directly to a numeric value. Out of the box NoHashHasher is enabled for u8, u16, u32, u64, usize, i8, i16, i32, i64, and isize. Types that should be used with NoHashHasher need to implement IsEnabled and by doing so assert that their Hash impl invokes only one of the Hasher::write_{u8, u16, u32, u64, usize, i8, i16, i32, i64, isize} methods exactly once.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

No runtime deps

Features