Skip to content

Commit b0cff2f

Browse files
committed
Added hash_builder to RawOccupiedEntryMut
1 parent cde5ae5 commit b0cff2f

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/map.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,7 +1457,7 @@ pub struct RawEntryBuilderMut<'a, K, V, S> {
14571457
/// [`RawEntryBuilderMut`]: struct.RawEntryBuilderMut.html
14581458
pub enum RawEntryMut<'a, K, V, S> {
14591459
/// An occupied entry.
1460-
Occupied(RawOccupiedEntryMut<'a, K, V>),
1460+
Occupied(RawOccupiedEntryMut<'a, K, V, S>),
14611461
/// A vacant entry.
14621462
Vacant(RawVacantEntryMut<'a, K, V, S>),
14631463
}
@@ -1466,21 +1466,24 @@ pub enum RawEntryMut<'a, K, V, S> {
14661466
/// It is part of the [`RawEntryMut`] enum.
14671467
///
14681468
/// [`RawEntryMut`]: enum.RawEntryMut.html
1469-
pub struct RawOccupiedEntryMut<'a, K, V> {
1469+
pub struct RawOccupiedEntryMut<'a, K, V, S> {
14701470
elem: Bucket<(K, V)>,
14711471
table: &'a mut RawTable<(K, V)>,
1472+
hash_builder: &'a S,
14721473
}
14731474

1474-
unsafe impl<K, V> Send for RawOccupiedEntryMut<'_, K, V>
1475+
unsafe impl<K, V, S> Send for RawOccupiedEntryMut<'_, K, V, S>
14751476
where
14761477
K: Send,
14771478
V: Send,
1479+
S: Sync,
14781480
{
14791481
}
1480-
unsafe impl<K, V> Sync for RawOccupiedEntryMut<'_, K, V>
1482+
unsafe impl<K, V, S> Sync for RawOccupiedEntryMut<'_, K, V, S>
14811483
where
14821484
K: Sync,
14831485
V: Sync,
1486+
S: Sync,
14841487
{
14851488
}
14861489

@@ -1549,6 +1552,7 @@ impl<'a, K, V, S> RawEntryBuilderMut<'a, K, V, S> {
15491552
Some(elem) => RawEntryMut::Occupied(RawOccupiedEntryMut {
15501553
elem,
15511554
table: &mut self.map.table,
1555+
hash_builder: &self.map.hash_builder,
15521556
}),
15531557
None => RawEntryMut::Vacant(RawVacantEntryMut {
15541558
table: &mut self.map.table,
@@ -1623,7 +1627,7 @@ impl<'a, K, V, S> RawEntryMut<'a, K, V, S> {
16231627
/// assert_eq!(entry.remove_entry(), ("horseyland", 37));
16241628
/// ```
16251629
#[cfg_attr(feature = "inline-more", inline)]
1626-
pub fn insert(self, key: K, value: V) -> RawOccupiedEntryMut<'a, K, V>
1630+
pub fn insert(self, key: K, value: V) -> RawOccupiedEntryMut<'a, K, V, S>
16271631
where
16281632
K: Hash,
16291633
S: BuildHasher,
@@ -1780,7 +1784,7 @@ impl<'a, K, V, S> RawEntryMut<'a, K, V, S> {
17801784
}
17811785
}
17821786

1783-
impl<'a, K, V> RawOccupiedEntryMut<'a, K, V> {
1787+
impl<'a, K, V, S> RawOccupiedEntryMut<'a, K, V, S> {
17841788
/// Gets a reference to the key in the entry.
17851789
#[cfg_attr(feature = "inline-more", inline)]
17861790
pub fn key(&self) -> &K {
@@ -1934,7 +1938,7 @@ impl<'a, K, V, S> RawVacantEntryMut<'a, K, V, S> {
19341938
}
19351939

19361940
#[cfg_attr(feature = "inline-more", inline)]
1937-
fn insert_entry(self, key: K, value: V) -> RawOccupiedEntryMut<'a, K, V>
1941+
fn insert_entry(self, key: K, value: V) -> RawOccupiedEntryMut<'a, K, V, S>
19381942
where
19391943
K: Hash,
19401944
S: BuildHasher,
@@ -1949,6 +1953,7 @@ impl<'a, K, V, S> RawVacantEntryMut<'a, K, V, S> {
19491953
RawOccupiedEntryMut {
19501954
elem,
19511955
table: self.table,
1956+
hash_builder: self.hash_builder,
19521957
}
19531958
}
19541959
}
@@ -1968,7 +1973,7 @@ impl<K: Debug, V: Debug, S> Debug for RawEntryMut<'_, K, V, S> {
19681973
}
19691974
}
19701975

1971-
impl<K: Debug, V: Debug> Debug for RawOccupiedEntryMut<'_, K, V> {
1976+
impl<K: Debug, V: Debug, S> Debug for RawOccupiedEntryMut<'_, K, V, S> {
19721977
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
19731978
f.debug_struct("RawOccupiedEntryMut")
19741979
.field("key", self.key())

0 commit comments

Comments
 (0)