@@ -15,7 +15,7 @@ type eqfn<K> = pure fn~(K, K) -> bool;
15
15
16
16
/// Open addressing with linear probing.
17
17
mod linear {
18
- export linear_map, linear_map_with_capacity;
18
+ export linear_map, linear_map_with_capacity, public_methods ;
19
19
20
20
const initial_capacity: uint = 32 u; // 2^5
21
21
type bucket < K , V > = { hash : uint , key : K , value : V } ;
@@ -64,7 +64,7 @@ mod linear {
64
64
p as & K
65
65
}
66
66
67
- impl private_const_methods < K , V > for & const linear_map < K , V > {
67
+ impl private_methods < K , V > for & const linear_map < K , V > {
68
68
#[ inline( always) ]
69
69
pure fn to_bucket ( h : uint ) -> uint {
70
70
// FIXME(#3041) borrow a more sophisticated technique here from
@@ -130,7 +130,7 @@ mod linear {
130
130
}
131
131
}
132
132
133
- impl private_mut_methods < K , V > for & mut linear_map < K , V > {
133
+ impl private_methods < K , V > for & mut linear_map < K , V > {
134
134
/// Expands the capacity of the array and re-inserts each
135
135
/// of the existing buckets.
136
136
fn expand( ) {
@@ -179,7 +179,7 @@ mod linear {
179
179
}
180
180
}
181
181
182
- impl mut_methods < K , V > for & mut linear_map < K , V > {
182
+ impl public_methods < K , V > for & mut linear_map < K , V > {
183
183
fn insert ( +k : K , +v : V ) -> bool {
184
184
if self . size >= self . resize_at {
185
185
// n.b.: We could also do this after searching, so
@@ -233,13 +233,13 @@ mod linear {
233
233
}
234
234
}
235
235
236
- impl private_imm_methods < K , V > for & linear_map < K , V > {
236
+ impl private_methods < K , V > for & linear_map < K , V > {
237
237
fn search ( hash : uint , op : fn ( x : & option < bucket < K , V > > ) -> bool ) {
238
238
let _ = self . bucket_sequence ( hash, |i| op ( & self . buckets [ i] ) ) ;
239
239
}
240
240
}
241
241
242
- impl const_methods < K , V > for & const linear_map < K , V > {
242
+ impl public_methods < K , V > for & const linear_map < K , V > {
243
243
fn size ( ) -> uint {
244
244
self . size
245
245
}
@@ -252,7 +252,7 @@ mod linear {
252
252
}
253
253
}
254
254
255
- impl const_methods < K , V : copy > for & const linear_map < K , V > {
255
+ impl public_methods < K , V : copy > for & const linear_map < K , V > {
256
256
fn find ( k : & K ) -> option < V > {
257
257
alt self . bucket_for_key ( self . buckets , k) {
258
258
found_entry ( idx) => {
0 commit comments