You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think even just a IntoRepr would be useful. I realize this could literally just wrap as usize, or similar. But for example, if used with #[repr(_)] this would mean you have similar behaviour to FromRepr, that would expose an into_repr function with a return type that respects the #[repr(_)].
And, more subjectively, this would allow use not to use as. From my experience there are some code bases that try to avoid as, preferring the try_into alternatives, where possible (mostly (u)int[8|16|32|64|128] convertions). This would be one more place where avoiding as would be possible.
For example, given an enum like this
I would like to have a function that converts each variant to a unique integer, like this:
Considerations:
IntoInteger
? MaybeIntoUsize
andIntoReprType
seprarately?The text was updated successfully, but these errors were encountered: