-
Notifications
You must be signed in to change notification settings - Fork 190
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
Generalized Vec
, implemented Vec::transmute_buffer
.
#430
base: main
Are you sure you want to change the base?
Conversation
Ready for the review! |
} | ||
} | ||
|
||
const fn as_ptr(&self) -> *const 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.
you can implement Deref
and DerefMut
into [T; N]
so all the usual slice methods are instantly available, without you having to wrap them.
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.
you can implement
Deref
andDerefMut
into[T; N]
so all the usual slice methods are instantly available, without you having to wrap them.
Done. And I kept the methods to provide const
alternatives.
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.
Does this actually have to be const
? If not, may as well remove it again, along with as_mut_ptr
and move the cast back.
i'm not 100% convinced we should have |
In defense of In order to avoid the pollution of the namespace, this method is provided only for
I'll try elaborate on the choice here. In order to make the transmutation in user code safe, it has to either expose this function ( |
Ready for review! |
Co-authored-by: Markus Reiter <[email protected]>
@reitermarkus Fixed |
@reitermarkus Fixed. |
We already expose the buffer with |
Another reason why I'm not particularly happy with leaving this to the user is that with the stabilization of Later on, we'll be able to deprecate the method and one day eventually even remove it if there's a need for a major update (= other breaking changes). EDIT: I thought more about it and I think it's alright to remove the method because this fix can be applied with Clippy. |
@JohnScience, can you rebase this? |
No description provided.