#hash #hasher #hashmap #hashset

archived 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

#1817 in Algorithms

Download history 100457/week @ 2023-10-18 104797/week @ 2023-10-25 111140/week @ 2023-11-01 129427/week @ 2023-11-08 159022/week @ 2023-11-15 124594/week @ 2023-11-22 152133/week @ 2023-11-29 143079/week @ 2023-12-06 124421/week @ 2023-12-13 85936/week @ 2023-12-20 64598/week @ 2023-12-27 124606/week @ 2024-01-03 128424/week @ 2024-01-10 152556/week @ 2024-01-17 139826/week @ 2024-01-24 105899/week @ 2024-01-31

550,879 downloads per month
Used in 1,333 crates (105 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