heapless icon indicating copy to clipboard operation
heapless copied to clipboard

[construct|deconstruct] Vec/String [from|to] length + [MaybeUninit<T>; N]

Open Felix-El opened this issue 1 year ago • 1 comments

These operations, let's call them from_parts / into_parts, I believe would be quite useful to allow the payload to change owners/container types without moving the data.

I don't think into_array<M>() can achieve the same because one has to statically know the exact runtime size. I thought about permitting M to be up to the capacity N but into_array would then have to pad the unused remaining space, which may be quite inefficient.

What are the chances of such MR to be accepted?

Felix-El avatar Aug 01 '24 17:08 Felix-El

I believe would be quite useful to allow the payload to change owners/container types without moving the data.

functions taking or returning the full [MaybeUninit<T>; N] will still move the data, I'm not sure if adding these functions will allow any performance improvements.

Dirbaio avatar Aug 01 '24 18:08 Dirbaio

Closing, since this would still move the data.

Feel free to re-open with a concrete use case example.

reitermarkus avatar Apr 27 '25 13:04 reitermarkus