Closed SK83RJOSH closed 7 months ago
this is not possible in the general case, at least not without reallocating, since memory allocated with one alignment must be deallocated with the same alignment
That's fine by me, it's just a nicety to make things less cumbersome. Particularly when moving data out of std/alloc::vec
. Right now I rely on from_slice
, but that has a runtime alignment parameter and I find it somewhat error prone since I use explicit const alignments as mentioned in my other issue. :)
with const alignments, i think you can just always pass 0 as an alignment argument but i forgot. it's been a while since i worked on this crate :sweat_smile: it's also undocumented. i'll try to find some time to make that part easier to work with
i documented the fact that you can pass in 0 as the alignment value, which will cause the vector to use the minimum possible alignment that satisfies both the type and alignment type requirements
It would be really handy to be able to go from an unaligned vec to an aligned vec and vice versa like so:
Additionally, it would be handy to go between
AVec
of different alignment values in the same way: