#hash #hasher #hashmap #hashset

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

#91 in Algorithms

Download history 29843/week @ 2022-04-27 32469/week @ 2022-05-04 32470/week @ 2022-05-11 31783/week @ 2022-05-18 27747/week @ 2022-05-25 28874/week @ 2022-06-01 31493/week @ 2022-06-08 45017/week @ 2022-06-15 64785/week @ 2022-06-22 66953/week @ 2022-06-29 68466/week @ 2022-07-06 70361/week @ 2022-07-13 41351/week @ 2022-07-20 37511/week @ 2022-07-27 36879/week @ 2022-08-03 29432/week @ 2022-08-10

156,481 downloads per month
Used in 287 crates (35 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

  • std