@@ -182,56 +182,40 @@ impl<'t, K, V> DerefMut<RawTable<K, V>> for &'t mut RawTable<K, V> {
182
182
}
183
183
}
184
184
185
- /// A bucket that holds a reference to the table
186
- pub trait BucketWithTable < M > {
185
+ // Buckets hold references to the table.
186
+ impl < K , V , M > FullBucket < K , V , M > {
187
187
/// Borrow a reference to the table.
188
- fn table ( & self ) -> & M ;
189
-
190
- /// Move out the reference to the table.
191
- fn into_table ( self ) -> M ;
192
-
193
- /// Get the raw index.
194
- fn index ( & self ) -> uint ;
195
- }
196
-
197
- impl < K , V , M > BucketWithTable < M > for FullBucket < K , V , M > {
198
- fn table ( & self ) -> & M {
188
+ pub fn table ( & self ) -> & M {
199
189
& self . table
200
190
}
201
-
202
- fn into_table ( self ) -> M {
191
+ /// Move out the reference to the table.
192
+ pub fn into_table ( self ) -> M {
203
193
self . table
204
194
}
205
-
206
- fn index ( & self ) -> uint {
195
+ /// Get the raw index.
196
+ pub fn index ( & self ) -> uint {
207
197
self . idx
208
198
}
209
199
}
210
200
211
- impl < K , V , M > BucketWithTable < M > for EmptyBucket < K , V , M > {
212
- fn table ( & self ) -> & M {
201
+ impl < K , V , M > EmptyBucket < K , V , M > {
202
+ /// Borrow a reference to the table.
203
+ pub fn table ( & self ) -> & M {
213
204
& self . table
214
205
}
215
-
216
- fn into_table ( self ) -> M {
206
+ /// Move out the reference to the table.
207
+ pub fn into_table ( self ) -> M {
217
208
self . table
218
209
}
219
-
220
- fn index ( & self ) -> uint {
221
- self . idx
222
- }
223
210
}
224
211
225
- impl < K , V , M > BucketWithTable < M > for Bucket < K , V , M > {
226
- fn table ( & self ) -> & M {
227
- & self . table
228
- }
229
-
230
- fn into_table ( self ) -> M {
212
+ impl < K , V , M > Bucket < K , V , M > {
213
+ /// Move out the reference to the table.
214
+ pub fn into_table ( self ) -> M {
231
215
self . table
232
216
}
233
-
234
- fn index ( & self ) -> uint {
217
+ /// Get the raw index.
218
+ pub fn index ( & self ) -> uint {
235
219
self . idx
236
220
}
237
221
}
@@ -454,7 +438,7 @@ impl<K, V, M: DerefMut<RawTable<K, V>>> FullBucket<K, V, M> {
454
438
}
455
439
}
456
440
457
- impl < ' t , K , V , M : Deref < RawTable < K , V > > > FullBucket < K , V , M > {
441
+ impl < ' t , K , V , M : Deref < RawTable < K , V > > + ' t > FullBucket < K , V , M > {
458
442
/// Exchange a bucket state for immutable references into the table.
459
443
/// Because the underlying reference to the table is also consumed,
460
444
/// no further changes to the structure of the table are possible;
@@ -468,7 +452,7 @@ impl<'t, K, V, M: Deref<RawTable<K, V>>> FullBucket<K, V, M> {
468
452
}
469
453
}
470
454
471
- impl < ' t , K , V , M : DerefMut < RawTable < K , V > > > FullBucket < K , V , M > {
455
+ impl < ' t , K , V , M : DerefMut < RawTable < K , V > > + ' t > FullBucket < K , V , M > {
472
456
/// This works similarly to `into_refs`, exchanging a bucket state
473
457
/// for mutable references into the table.
474
458
pub fn into_mut_refs ( self ) -> ( & ' t mut K , & ' t mut V ) {
0 commit comments