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

feat: Implement hash for Code #917

Merged
merged 1 commit into from Feb 21, 2022
Merged

Conversation

faern
Copy link
Contributor

@faern faern commented Feb 20, 2022

Motivation

I want to have a HashMap<Code, u64> to keep some statistics on various codes servers return. But Code is not Hash. I don't see any reason why it would not be. It's just a simple enum.

I can of course keep a HashMap<u32, u64> and upon insertion cast the enum to an integer. But I don't know the width of the integer as it's not part of the public API. And it also does not allow me to get the nice string description of the code out of the hashmap keys later.

Solution

Implement Hash for Code.

@LucioFranco LucioFranco changed the title Implement Hash for Code feat: Implement hash for Code Feb 21, 2022
@LucioFranco LucioFranco merged commit 6bc7dab into hyperium:master Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants