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

Validation: required_spec_claims HashSet should use a non-allocating value type. #385

Open
fetchfern opened this issue Apr 18, 2024 · 1 comment

Comments

@fetchfern
Copy link

I can't see any reason why required_spec_claims couldn't be a HashSet<&'static str>, or, even better, use an enum instead.

Using a String as the value type leads to unnecessary allocations as well as assigning to that field being rather unergonomic. Having to convert your &'static strs to owned strings is annoying and wasteful.

Current workaround is to just not use the feature.

@Keats
Copy link
Owner

Keats commented Apr 19, 2024

I don't remember why it's that way but Validation has been like that for >7 years.
In practice I think most users create a Validation struct once in their program and re-use it (the original intended use) so allocations are not an issue in that case

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