Currently cxx-qt-lib's advantage is that we can define a trivial type as we alias the C++ type to a struct with a known size and assert it on either side.
What if we could do the following
#[cxx_qt::bridge]
mod ffi {
unsafe extern "C++Qt" {
#[cxx_qt_size(usize, usize, usize)] // maybe alignment too?
type QString;
}
}Then could the bridge automatically generate the struct with the MaybeUninit and the assert on the C++ side?
There would then be questions over automatically implementing Clone/Drop/Default etc? Some of these should probably be attributes as they affect the movable asserts on the C++ side.
Activity
3I can definitely see how that would be nice to have. However, it would mostly be a convenience for cxx-qt-lib...
If anything, this really belongs into CXX itself, so I wouldn't want to add this to CXX-Qt, as it would be public API surface that we need to maintain...
Thing is some of the asserts like the QTypeInfo::isRelocatable would be Qt specific asserts 🤔
Could we even always implement a Drop and then in the C++ have a static check whether it needs to be called or not?
Then things like Clone/Default could be up to the developer / another attribute.