Closed forrestli74 closed 6 months ago
I was really looking for a solution with no copy or new allocation. I didn't know this was impossible. Any suggestions for future reading? Thanks
bytemuck::allocation::BoxBytes
might fit your use-case, however it currently doesn't support casting to/from boxed slices, only boxed Sized types.
Thanks!
You can't go directly from
Box<[u64]>
toBox<[u8]>
due to allocation alognment requirements, but you can usecast_slice
and thenslice::to_vec
to get an owned vec in a new allocation (and thenVec::into_boxed_slice
if needed)