Extension of #134 for non-enum structures. In non-enum structures, there's no way to move a single non-Copy field out and leave a placeholder (or a default constructed type). The usual Rust pattern is std::mem::replace(&mut foo.field, placeholder) and I don't think zngur supports A C++ equivalent atm.
My proposal would be to generate a Rust extern function per field that does the std::mem::replace and on the C++ side you can call T replace(T placeholder) to FieldRefMut (incl. specializations).
This is always safe because the field is always left initialized.
#133 as a pre-requisite would make sense to put replace in the CRTP perhaps if this idea is retained.
Extension of #134 for non-enum structures. In non-enum structures, there's no way to move a single non-
Copyfield out and leave a placeholder (or a default constructed type). The usual Rust pattern isstd::mem::replace(&mut foo.field, placeholder)and I don't think zngur supports A C++ equivalent atm.My proposal would be to generate a Rust extern function per field that does the
std::mem::replaceand on the C++ side you can callT replace(T placeholder)toFieldRefMut(incl. specializations).This is always safe because the field is always left initialized.
#133 as a pre-requisite would make sense to put
replacein the CRTP perhaps if this idea is retained.