Skip to content

Commit

Permalink
timers: inline hint for timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
cmeissl committed Jun 8, 2024
1 parent 58aa9da commit a21bc53
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/sources/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,15 @@ impl TimerWheel {
// trait implementations for TimeoutData

impl std::cmp::Ord for TimeoutData {
#[inline]
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
// earlier values have priority
self.deadline.cmp(&other.deadline).reverse()
}
}

impl std::cmp::PartialOrd for TimeoutData {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
Expand All @@ -292,6 +294,7 @@ impl std::cmp::PartialOrd for TimeoutData {
// and the type is private, so ignore its coverage
impl std::cmp::PartialEq for TimeoutData {
#[cfg_attr(feature = "nightly_coverage", coverage(off))]
#[inline]
fn eq(&self, other: &Self) -> bool {
self.deadline == other.deadline
}
Expand Down

0 comments on commit a21bc53

Please sign in to comment.