I like the Ida of implementing Into for such types, through instead of having some “special” Into
I think it would be nice, if all repr(<inttype>)
repr’s would imply that a impl
for Into
is generated.
But this might lead to some problems when the actual repr
is more of a implementation detail (e.g. with a C interface) and some Into<inttype>
should be implemented witch does not directly represents the underlying value (but then having such a structure is generally a bad idea I think)
Another question is if another .into()
is the best choice of name or if it might make sens to show that this is “just” the internal repr of the enum, e.g. .into_raw()
or so. Having a explicity method name for this as
-usage would prevent the problem mentioned above and enable a automatic implementation of the respecting trait. Oh, and it fits with the into_raw methods of Box
, and CString
witch do roughly the same in a situation where as
cannot be used.