File tree 1 file changed +2
-32
lines changed
1 file changed +2
-32
lines changed Original file line number Diff line number Diff line change 6
6
# Summary
7
7
[ summary ] : #summary
8
8
9
- Extend the ` Hasher ` trait with a ` fn delimit ` method. Add an unstable Farmhash
10
- implementation to the standard library.
9
+ Extend the ` Hasher ` trait with a ` fn delimit ` method.
11
10
12
11
# Motivation
13
12
[ motivation ] : #motivation
@@ -48,45 +47,16 @@ trait Hasher {
48
47
}
49
48
```
50
49
51
- Farmhash is introduced as an unstable struct at ` core::hash::FarmHasher ` . It
52
- should not be exposed in to users of stable Rust.
53
-
54
- It may be implemented in the standard library as follows.
55
-
56
- ``` rust
57
- struct FarmHasher {
58
- hash : u64
59
- }
60
-
61
- impl Hasher for FarmHasher {
62
- fn write (& mut self , input : & [u8 ]) {
63
- self . hash = farmhash :: hash64 (input );
64
- }
65
-
66
- fn delimit (& mut self , _len : usize ) {
67
- // Nothing to do.
68
- }
69
-
70
- fn finish (& mut self ) -> u64 {
71
- self . hash
72
- }
73
- }
74
- ```
75
-
76
50
# Drawbacks
77
51
[ drawbacks ] : #drawbacks
78
52
79
- * There will be yet another hashing algorithm to maintain in the standard library.
80
53
* The ` Hasher ` trait becomes larger.
81
54
82
55
# Alternatives
83
56
[ alternatives ] : #alternatives
84
57
85
- * Leaving out either or both of these. This means adaptive hashing won't work for
58
+ * Leaving out this, which means adaptive hashing may not work for
86
59
string and slice types.
87
- * Introducing Farmhash as an unstable function.
88
- * Adding the ` fn delimit ` method, but leaving out Farmhash.
89
- * Using MetroHash or some other algorithm instead of Farmhash.
90
60
* Changing SipHash to ignore the first delimiter.
91
61
92
62
# Unresolved questions
You can’t perform that action at this time.
0 commit comments