soa-derive
soa-derive copied to clipboard
Adds support for Drop types.
Could you elaborate a bit on why forwarding to write
for each field (i.e. #(self.#fields_names_1.write(val.#fields_names_2); )*
) is not sufficient and why this needs to use ManuallyDrop?
Without ManuallyDrop
, the original value still gets dropped at the end of the scope, leading to e.g. double-frees.
And why not use std::mem::forget
?
Either one could work.
Ok, I hope I'll have time to do a full review of this (in particular checking that the manually drop/forget was added to all required functions) later this week.
Just had the time to finish the review here. I also rebased on top of master and added another test for ptr::write.
The code looks sound, so if you are happy with the current state I can merge and release this!