File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -22,8 +22,8 @@ trait SendMap<K:Eq Hash, V: Copy> {
22
22
fn each_value_ref ( & self , blk : fn ( v : & V ) -> bool ) ;
23
23
fn find ( & const self , k : & K ) -> Option < V > ;
24
24
fn get ( & const self , k : & K ) -> V ;
25
- fn with_find_ref < T > ( & const self , k : & K , blk : fn ( Option < & V > ) -> T ) -> T ;
26
- fn with_get_ref < T > ( & const self , k : & K , blk : fn ( v : & V ) -> T ) -> T ;
25
+ fn find_ref ( & self , k : & K ) -> Option < & self / V > ;
26
+ fn get_ref ( & self , k : & K ) -> & self / V ;
27
27
}
28
28
29
29
/// Open addressing with linear probing.
@@ -304,6 +304,13 @@ mod linear {
304
304
}
305
305
}
306
306
307
+ fn get_ref ( & self , k : & K ) -> & self /V {
308
+ match self . find_ref ( k) {
309
+ Some ( v) => v,
310
+ None => fail fmt ! ( "No entry found for key: %?" , k) ,
311
+ }
312
+ }
313
+
307
314
fn each_ref ( & self , blk : fn ( k : & K , v : & V ) -> bool ) {
308
315
for vec:: each( self . buckets) |slot| {
309
316
let mut broke = false ;
You can’t perform that action at this time.
0 commit comments