Skip to content

Commit

Permalink
tokio-util: expose key used in DelayQueue's Expired (#4081)
Browse files Browse the repository at this point in the history
Signed-off-by: Toby Lawrence <toby@nuclearfurnace.com>
  • Loading branch information
tobz committed Aug 31, 2021
1 parent 909d3ec commit 23b0aee
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tokio-util/src/time/delay_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ pub struct Expired<T> {
///
/// [`DelayQueue`]: struct@DelayQueue
/// [`DelayQueue::insert`]: method@DelayQueue::insert
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
pub struct Key {
index: usize,
}
Expand Down Expand Up @@ -921,4 +921,9 @@ impl<T> Expired<T> {
pub fn deadline(&self) -> Instant {
self.deadline
}

/// Returns the key that the expiration is indexed by.
pub fn key(&self) -> Key {
self.key
}
}

0 comments on commit 23b0aee

Please sign in to comment.