-
Notifications
You must be signed in to change notification settings - Fork 90
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
Implement try_transmute!
#1013
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We should implement
try_transmute!
, analogous totransmute!
, that performs compile-time size and alignment checks, but also a run-time validity check.Considerations
Due to the run-time validity check, this macro will not be usable in const contexts for the foreseeable future. (But we could perhaps work around this by also providing
const fn is_bit_valid
inherent methods in our derive; see #115.)The implementation should avoid performing dynamic size or alignment checks.
Steps
Once #999 is merged, we can define a typed alternative to
is_bit_valid
onTryFromBytes
:The dynamic components of
try_transmute!
can then be factored into a helper function:The text was updated successfully, but these errors were encountered: