Skip to content

Commit

Permalink
Auto merge of #505 - Zoxc:table-inline, r=Amanieu
Browse files Browse the repository at this point in the history
Inline tweaks to `HashTable`

This brings the inlining behavior more in line with `HashMap`.
  • Loading branch information
bors committed Feb 15, 2024
2 parents d563de1 + 66b2fd8 commit 36ce4b3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ where
/// # test()
/// # }
/// ```
#[cfg_attr(feature = "inline-more", inline)]
pub fn find_entry(
&mut self,
hash: u64,
Expand Down Expand Up @@ -358,6 +359,7 @@ where
/// # test()
/// # }
/// ```
#[cfg_attr(feature = "inline-more", inline)]
pub fn entry(
&mut self,
hash: u64,
Expand Down Expand Up @@ -1514,6 +1516,7 @@ where
/// # test()
/// # }
/// ```
#[cfg_attr(feature = "inline-more", inline)]
pub fn remove(self) -> (T, VacantEntry<'a, T, A>) {
let (val, slot) = unsafe { self.table.raw.remove(self.bucket) };
(
Expand Down Expand Up @@ -1553,6 +1556,7 @@ where
/// # test()
/// # }
/// ```
#[inline]
pub fn get(&self) -> &T {
unsafe { self.bucket.as_ref() }
}
Expand Down Expand Up @@ -1606,6 +1610,7 @@ where
/// # test()
/// # }
/// ```
#[inline]
pub fn get_mut(&mut self) -> &mut T {
unsafe { self.bucket.as_mut() }
}
Expand Down Expand Up @@ -1759,6 +1764,7 @@ where
/// # test()
/// # }
/// ```
#[inline]
pub fn insert(self, value: T) -> OccupiedEntry<'a, T, A> {
let bucket = unsafe {
self.table
Expand Down

0 comments on commit 36ce4b3

Please sign in to comment.