Skip to content

Commit c59ede7

Browse files
newAMeldruin
authored andcommitted
hashers: derive Debug
This follows the C-DEBUG API guideline, and aligns with std::hash::DefaultHasher.
1 parent 1cc2887 commit c59ede7

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Added `Debug` implementations to hashers.
13+
1014
### Changed
1115

1216
- Updated the edition from 2015 to 2021.
@@ -16,7 +20,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1620
- Removed the `byteorder` dependency.
1721
- Removed the `BuildHasherDefault` type.
1822
- This type existed because `core::hash::BuildHasherDefault` did not have a const constructor.
19-
- As of 1.85 core::hash::BuildHasherDefault has a const constructor.
23+
- As of 1.85 `core::hash::BuildHasherDefault` has a const constructor.
2024

2125
## [v0.3.1] - 2022-08-09
2226

src/fnv.rs

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const PRIME: u32 = 0x1000193;
88
/// Specifically this implements the [FNV-1a hash].
99
///
1010
/// [FNV-1a hash]: https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function#FNV-1a_hash
11+
#[derive(Debug)]
1112
pub struct FnvHasher {
1213
state: u32,
1314
}

src/murmur3.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,24 @@ use core::slice;
44
use crate::Hasher as _;
55

66
/// 32-bit `MurmurHash3` hasher
7+
#[derive(Debug)]
78
pub struct Murmur3Hasher {
89
buf: Buffer,
910
index: Index,
1011
processed: u32,
1112
state: State,
1213
}
1314

15+
#[derive(Debug)]
1416
struct State(u32);
1517

16-
#[derive(Clone, Copy)]
18+
#[derive(Debug, Clone, Copy)]
1719
#[repr(align(4))]
1820
struct Buffer {
1921
bytes: MaybeUninit<[u8; 4]>,
2022
}
2123

22-
#[derive(Clone, Copy, PartialEq)]
24+
#[derive(Debug, Clone, Copy, PartialEq)]
2325
enum Index {
2426
_0,
2527
_1,

0 commit comments

Comments
 (0)