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

Allow enum from primitive creation to be used in a const context #159

Open
tetofonta opened this issue Feb 2, 2025 · 0 comments
Open

Allow enum from primitive creation to be used in a const context #159

tetofonta opened this issue Feb 2, 2025 · 0 comments

Comments

@tetofonta
Copy link

Because FromPrimitive is a trait, the function implementing this operation cannot be declared as const as per the current rust definitions.
This implies that using from_primitive(value) inside a const is impossible.

A const implementation can be added in a direct impl during derivation to allow for this behaviour.

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

1 participant