File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,5 @@ edition = "2018"
7
7
8
8
[dependencies ]
9
9
indexmap = { path = " .." , features = [" serde-1" ] }
10
- # no-std compatible hasher
11
- twox-hash = { version = " 1.5" , default-features = false }
12
10
13
11
[dev-dependencies ]
Original file line number Diff line number Diff line change 1
1
#![ no_std]
2
2
3
3
use core:: hash:: BuildHasherDefault ;
4
+ use core:: hash:: Hasher ;
5
+ use core:: iter:: FromIterator ;
6
+
4
7
use indexmap:: IndexMap ;
5
8
use indexmap:: IndexSet ;
6
- use twox_hash:: XxHash64 ;
7
- type Map < K , V > = IndexMap < K , V , BuildHasherDefault < XxHash64 > > ;
8
- type Set < T > = IndexSet < T , BuildHasherDefault < XxHash64 > > ;
9
9
10
- use core:: iter:: FromIterator ;
10
+ #[ derive( Default ) ]
11
+ struct BadHasher ( u64 ) ;
12
+
13
+ impl Hasher for BadHasher {
14
+ fn finish ( & self ) -> u64 { self . 0 }
15
+ fn write ( & mut self , bytes : & [ u8 ] ) {
16
+ for & byte in bytes {
17
+ self . 0 += byte as u64
18
+ }
19
+ }
20
+ }
21
+
22
+ type Map < K , V > = IndexMap < K , V , BuildHasherDefault < BadHasher > > ;
23
+ type Set < T > = IndexSet < T , BuildHasherDefault < BadHasher > > ;
11
24
12
25
pub fn test_compile ( ) {
13
26
let mut map = Map :: default ( ) ;
You can’t perform that action at this time.
0 commit comments