Skip to content

Commit 037abd5

Browse files
newAMeldruin
authored andcommitted
Change struct names to match exported name
This helps readability to distinguish between the Hasher trait, and the structs that implement the Hasher trait.
1 parent 34815f6 commit 037abd5

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/fnv.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,24 @@ 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-
pub struct Hasher {
11+
pub struct FnvHasher {
1212
state: u32,
1313
}
1414

15-
impl Default for Hasher {
15+
impl Default for FnvHasher {
1616
fn default() -> Self {
1717
Self { state: BASIS }
1818
}
1919
}
2020

21-
impl crate::Hasher for Hasher {
21+
impl crate::Hasher for FnvHasher {
2222
#[inline]
2323
fn finish32(&self) -> u32 {
2424
self.state
2525
}
2626
}
2727

28-
impl core::hash::Hasher for Hasher {
28+
impl core::hash::Hasher for FnvHasher {
2929
#[inline]
3030
fn write(&mut self, bytes: &[u8]) {
3131
for byte in bytes {

src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
)]
4949
#![no_std]
5050

51-
pub use crate::fnv::Hasher as FnvHasher;
52-
pub use crate::murmur3::Hasher as Murmur3Hasher;
51+
pub use crate::fnv::FnvHasher;
52+
pub use crate::murmur3::Murmur3Hasher;
5353

5454
mod fnv;
5555
mod murmur3;

src/murmur3.rs

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

66
/// 32-bit `MurmurHash3` hasher
7-
pub struct Hasher {
7+
pub struct Murmur3Hasher {
88
buf: Buffer,
99
index: Index,
1010
processed: u32,
@@ -50,7 +50,7 @@ impl From<usize> for Index {
5050
}
5151
}
5252

53-
impl Hasher {
53+
impl Murmur3Hasher {
5454
/// # Safety
5555
///
5656
/// The caller must ensure that `self.index.usize() + buf.len() <= 4`.
@@ -72,7 +72,7 @@ impl Hasher {
7272
}
7373
}
7474

75-
impl Default for Hasher {
75+
impl Default for Murmur3Hasher {
7676
fn default() -> Self {
7777
Self {
7878
buf: Buffer {
@@ -85,7 +85,7 @@ impl Default for Hasher {
8585
}
8686
}
8787

88-
impl crate::Hasher for Hasher {
88+
impl crate::Hasher for Murmur3Hasher {
8989
fn finish32(&self) -> u32 {
9090
// tail
9191
let mut state = match self.index {
@@ -128,7 +128,7 @@ impl crate::Hasher for Hasher {
128128
}
129129
}
130130

131-
impl core::hash::Hasher for Hasher {
131+
impl core::hash::Hasher for Murmur3Hasher {
132132
#[inline]
133133
fn write(&mut self, bytes: &[u8]) {
134134
let len = bytes.len();

0 commit comments

Comments
 (0)