You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be cool if there was support for safer_ffi opaque types that don't require boxing because they are Copy. Ostensibly, one could just look at the size and alignment of the type and create a C type with the same layout. This is what autocxx does and it seems to work well:
I'm assuming that this solution won't work for non-copy types (implying that they have a drop fn and cannot be memcopied), but in my API I have a bunch of opaque types that are Copy, and I'l really like to avoid boxing all of them, and having the caller have to allocate and drop them all the time
The text was updated successfully, but these errors were encountered:
It would be cool if there was support for
safer_ffi
opaque types that don't require boxing because they areCopy
. Ostensibly, one could just look at the size and alignment of the type and create a C type with the same layout. This is whatautocxx
does and it seems to work well:Generated rust code:
Corresponding C/C++ POD type:
I'm assuming that this solution won't work for non-copy types (implying that they have a drop fn and cannot be memcopied), but in my API I have a bunch of opaque types that are
Copy
, and I'l really like to avoid boxing all of them, and having the caller have to allocate and drop them all the timeThe text was updated successfully, but these errors were encountered: