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

Support for converting into multiple int types besides repr? #157

Open
tyrone-wu opened this issue Nov 13, 2024 · 0 comments
Open

Support for converting into multiple int types besides repr? #157

tyrone-wu opened this issue Nov 13, 2024 · 0 comments

Comments

@tyrone-wu
Copy link

tyrone-wu commented Nov 13, 2024

Hi 👋.

Would you be open to adding or accepting a PR that would implement Into for multiple int types?

For context, the codebase I'm working with has several generated enums. We're currently pushing to eliminate as much as castings and funnel all enum -> int conversions through a less "foot-gunny" API. In some instances, we're using #[repr(u32)] enums as a u64.

What's currently barring us from using https://github.com/rust-num/num-derive is it assumes the variant can validly be represented as a i64. It doesn't take into consideration the repr, which would defeat the purpose of eliminating this footgun. Even though it'll be unlikely we'll encounter this issue, we would still like to be safe 🧷.

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