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

no-std nohash

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

Show the crate…

2 unstable releases

0.2.0 Mar 3, 2021
0.0.0 Mar 3, 2021

#59 in #hash-set

Download history 2542/week @ 2024-07-19 2793/week @ 2024-07-26 1771/week @ 2024-08-02 1666/week @ 2024-08-09 2066/week @ 2024-08-16 1948/week @ 2024-08-23 2180/week @ 2024-08-30 2147/week @ 2024-09-06 2130/week @ 2024-09-13 2399/week @ 2024-09-20 3718/week @ 2024-09-27 3973/week @ 2024-10-04 5543/week @ 2024-10-11 6003/week @ 2024-10-18 7455/week @ 2024-10-25 6871/week @ 2024-11-01

26,406 downloads per month
Used in 65 crates (11 directly)

Apache-2.0 OR MIT

15KB
246 lines

Nohash Hasher

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