-
Notifications
You must be signed in to change notification settings - Fork 13
Closed
Description
bytemuck allows safe transmuting of simple types with no uninhabited values. I would be really useful if hybrid-array implemented it the same way bytemuck implements it on native constant-sized arrays. Obviously, the dependency would be optional.
How ?
This is the impl for the standard generic array, it should be trivial to adapt:
unsafe impl<T, const N: usize> Pod for [T; N] where T: Pod {}Why ?
bytemuckis quite popular (3.5M downloads/month, 600+ GH stars)- Implementing it would instantly make hybrid arrays of int/bytes/etc. safely transmutable with other kinds of arrays at no cost, including non-standard ones
Why not ?
- It adds a dependency
- It's always possible to get access to the underlying
&[T; N]/&mut [T; N](and vice-versa) using normalhybrid_array::Arraymethods and give these tobytemuckinstead. It adds one "level" of conversion, which is acceptable.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels