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"
77
88[dependencies ]
99indexmap = { path = " .." , features = [" serde-1" ] }
10- # no-std compatible hasher
11- twox-hash = { version = " 1.5" , default-features = false }
1210
1311[dev-dependencies ]
Original file line number Diff line number Diff line change 11#![ no_std]
22
33use core:: hash:: BuildHasherDefault ;
4+ use core:: hash:: Hasher ;
5+ use core:: iter:: FromIterator ;
6+
47use indexmap:: IndexMap ;
58use 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 > > ;
99
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 > > ;
1124
1225pub fn test_compile ( ) {
1326 let mut map = Map :: default ( ) ;
You can’t perform that action at this time.
0 commit comments