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

Derive Hash for all types #78

Open
benluelo opened this issue Sep 25, 2023 · 3 comments
Open

Derive Hash for all types #78

benluelo opened this issue Sep 25, 2023 · 3 comments

Comments

@benluelo
Copy link

Would be very handy to allow for them to be stored as keys in Hash{Map,Set}s.

@ahl
Copy link
Collaborator

ahl commented Oct 20, 2023

In addition to Hash I think you'd need Eq which can't be derived in particular because NumberType contains f64s that don't implement Eq. I'm planning on closing this in the next few days, but even if you get back here and it's closed I would invite comments or suggestions to satisfy your use case. If you don't get a response, feel free to open a new issue and my apologies if it seems like this was closed prematurely!

@benluelo
Copy link
Author

you could use something like https://docs.rs/ordered-float/latest/ordered_float/ for NumberType, i don't think NaN is valid in an openapi spec anyways(?)

@ahl
Copy link
Collaborator

ahl commented Oct 20, 2023

I think that equality issues aren't limited to NaNs

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

No branches or pull requests

2 participants