uniffi-rs
uniffi-rs copied to clipboard
External type fails for some corner cases
It's tricky to get the FFI function signatures correct for external types since we don't know the concrete actual type. Here's where we determine the FFI type to use. I can think of at least 2 cases where this will fail:
- A external custom type that wraps a primitive type. There's no way to represent that with
ExternalKind - A "doubly external" type:
crate1defines a type,crate2uses it as an external type,crate3uses that type fromcrate2as it's external type. In this case, theRustBuffercrate name will be wrong. This is a pretty weird case, but if we could support it it would be nice.
Now that the proc-macro metadata code has matured, I think we can fix both of these issues by:
- Replacing
ExternalKindwith the actual type definition. - Making
namerefer to the crate that the type was originally defined in.