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

How to use enum as K in FnvIndexMap #366

Open
TENX-S opened this issue May 13, 2023 · 0 comments
Open

How to use enum as K in FnvIndexMap #366

TENX-S opened this issue May 13, 2023 · 0 comments
Labels

Comments

@TENX-S
Copy link

TENX-S commented May 13, 2023

I have an enum that I want to use as the key type in an FnvIndexMap.:

use hash32_derive::Hash32;

#[derive(Hash, Hash32)]
pub enum Command {
  // ...
}
// says "#[derive(Hash)] doesn't currently support `enum` and `union`"

static M: FnvIndexMap<Command, u32, 3> = FnvIndexMap::from_iter([(Command::Send, 1)]);
// says `the trait bound `Command: hash32::Hash` is not satisfied`

I noticed that a related issue rust-embedded-community/hash32#3 has been closed, but it seems that the problem still persists.

@newAM newAM added the question label Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants