-
Notifications
You must be signed in to change notification settings - Fork 105
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
Use AlignmentError
in Unalign
's failure conditions
#1198
Conversation
src/pointer/ptr.rs
Outdated
I: Invariants, | ||
{ | ||
/// Converts a `Ptr` to a `Unalign<T>` into an `Ptr` to an unaligned `T`. | ||
pub(crate) fn into_unaligned( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub(crate) fn into_unaligned( | |
pub(crate) fn into_unalign( |
@@ -613,12 +613,41 @@ mod _conversions { | |||
c | |||
} | |||
} | |||
|
|||
impl<'a, T, I> Ptr<'a, T, I> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fancy doc comment here with the UTF-8 arrow character?
src/pointer/ptr.rs
Outdated
where | ||
I: Invariants, | ||
{ | ||
/// Converts a `Ptr` to a `Unalign<T>` into an `Ptr` to an unaligned `T`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Converts a `Ptr` to a `Unalign<T>` into an `Ptr` to an unaligned `T`. | |
/// Converts an unaligned `Ptr<T>` to an aligned `Ptr<Unalign<T>>`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the outstanding comments, but feel free to merge after that.
This make's `Unalign`'s methods consistent with zerocopy's other methods, and, in the case of `Unalign::try_deref_mut`, allows the original `&mut Unalign<T>` to be reused in the event of failure. Makes progress towards #1139
This make's
Unalign
's methods consistent with zerocopy's other methods, and, in the case ofUnalign::try_deref_mut
, allows the original&mut Unalign<T>
to be reused in the event of failure.Makes progress towards #1139