f clarification, docs
This commit is contained in:
parent
c9b3cd47e2
commit
64adca717f
2 changed files with 10 additions and 2 deletions
|
|
@ -455,6 +455,11 @@ fn robin_hood<'a, K: 'a, V: 'a>(bucket: FullBucketMut<'a, K, V>,
|
|||
let bucket = bucket.put(hash, key, val);
|
||||
// Now that it's stolen, just read the value's pointer
|
||||
// right out of the table! Go back to the *starting point*.
|
||||
//
|
||||
// This use of `into_table` is misleading. It turns the
|
||||
// bucket, which is a FullBucket on top of a
|
||||
// FullBucketMut, into just one FullBucketMut. The "table"
|
||||
// refers to the inner FullBucketMut in this context.
|
||||
return bucket.into_table().into_mut_refs().1;
|
||||
},
|
||||
Full(bucket) => bucket
|
||||
|
|
|
|||
|
|
@ -421,8 +421,9 @@ impl<K, V, M: Deref<Target=RawTable<K, V>>> FullBucket<K, V, M> {
|
|||
}
|
||||
}
|
||||
|
||||
// We don't need a `Take` trait currently. This is why a mutable reference
|
||||
// to the table is required.
|
||||
// We take a mutable reference to the table instead of accepting anything that
|
||||
// implements `DerefMut` to prevent fn `take` from being called on `stash`ed
|
||||
// buckets.
|
||||
impl<'t, K, V> FullBucket<K, V, &'t mut RawTable<K, V>> {
|
||||
/// Removes this bucket's key and value from the hashtable.
|
||||
///
|
||||
|
|
@ -446,6 +447,8 @@ impl<'t, K, V> FullBucket<K, V, &'t mut RawTable<K, V>> {
|
|||
}
|
||||
}
|
||||
|
||||
// This use of `Put` is misleading and restrictive, but safe and sufficient for our use cases
|
||||
// where `M` is a full bucket or table reference type with mutable access to the table.
|
||||
impl<K, V, M> FullBucket<K, V, M> where M: Put<K, V> {
|
||||
pub fn replace(&mut self, h: SafeHash, k: K, v: V) -> (SafeHash, K, V) {
|
||||
unsafe {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue