@@ -12,9 +12,11 @@ use core::{
12
12
hash:: Hash ,
13
13
sync:: atomic:: { AtomicU8 , Ordering } ,
14
14
} ;
15
- use parking_lot:: { MappedRwLockReadGuard , RwLock , RwLockReadGuard , RwLockUpgradableReadGuard } ;
15
+ use parking_lot:: { RwLock , RwLockReadGuard , RwLockUpgradableReadGuard } ;
16
16
use std:: { collections:: hash_map:: RandomState , hash:: BuildHasher } ;
17
17
18
+ pub use parking_lot:: MappedRwLockReadGuard as ReadGuard ;
19
+
18
20
pub struct Map < K , V , S = RandomState > {
19
21
slots : Box < [ Slot < K , V > ] > ,
20
22
hash_builder : S ,
94
96
self . get_by_key ( key) . is_some ( )
95
97
}
96
98
97
- pub fn get_by_key ( & self , key : & K ) -> Option < MappedRwLockReadGuard < ' _ , V > > {
99
+ pub fn get_by_key ( & self , key : & K ) -> Option < ReadGuard < ' _ , V > > {
98
100
self . slot_by_hash ( key) . get_by_key ( key)
99
101
}
100
102
}
@@ -148,7 +150,7 @@ where
148
150
None
149
151
}
150
152
151
- fn get_by_key ( & self , needle : & K ) -> Option < MappedRwLockReadGuard < ' _ , V > > {
153
+ fn get_by_key ( & self , needle : & K ) -> Option < ReadGuard < ' _ , V > > {
152
154
// Scan each value and check if our requested needle is present.
153
155
let values = self . values . read ( ) ;
154
156
for ( value_idx, value) in values. iter ( ) . enumerate ( ) {
0 commit comments