Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tokio-util: expose key used in DelayQueue's Expired #4081

Merged
merged 1 commit into from
Aug 31, 2021

Conversation

tobz
Copy link
Member

@tobz tobz commented Aug 30, 2021

Motivation

It's useful to be able to extract the Key assigned to a given entry in a DelayQueue when being handed back an expired item, so that callers can interact with the delay queue in a correct fashion.

Solution

We've exposed the Key used in Expired<T> such that it can be not only accessed from Expired<T>, but is now also Copy, Eq, and Hash, so it can be easily used in hash maps and sets, as well as trivially copied, since it's just a usize under the hood.

Signed-off-by: Toby Lawrence toby@nuclearfurnace.com

Signed-off-by: Toby Lawrence <toby@nuclearfurnace.com>
@Darksonn Darksonn added A-tokio-util Area: The tokio-util crate M-time Module: tokio/time labels Aug 31, 2021
@tobz tobz merged commit 23b0aee into master Aug 31, 2021
@tobz tobz deleted the tobz/delay-queue-expose-key branch August 31, 2021 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio-util Area: The tokio-util crate M-time Module: tokio/time
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants