uniffi-rs
uniffi-rs copied to clipboard
Custom Types from external crate do not generate correct binding function signature when used in exports
Tested with uniffi v0.26.1.
When using custom types declared in another crate, the generated uniffi binding code does not generate the correct function signature for the bindings. This may be potentially related to #1988. I have verified this happens with the Swift binding generator, but could also affect other languages
Example
Crate A:
pub struct MyType(u64);
uniffi::custom_new_type(MyType,u64);
#[uniffi::export]
pub fn crate_a_test(t:MyType);
Crate B:
use crate_a::MyType;
// Due to #1988
uniffi::ffi_converter_forward(crate_a::MyType, crate_a::UniFfiTtag, crate::UniFiiTag);
#[uniffi::export]
pub fn crate_b_test(t:MyType);
Crate A will generate the following function signature:
uniffi_crate_a_fn_crate_a_test(uin64 t);
Where as Crate B will generate:
uniffi_crate_b_fn_crate_b_test(RustBuffer t);
I'm happy to assist in resolving this issue if someone can provide me some pointers on where this is handled in the code.