uniffi-rs icon indicating copy to clipboard operation
uniffi-rs copied to clipboard

Support Arc<_> and impl blocks in proc-macro frontend

Open jplatte opened this issue 3 years ago • 1 comments

This is incomplete, but I wanted to post a PR anyways so others can have a look at the progress.

Left to do:

  • To avoid problems from the same name meaning different things across modules that #[uniffi::export] is used in,
    • create a new macro that's used at the crate root where users have to list the named types they want to use in FFI, sth. like uniffi::types! { Foo, some_place::Bar }, which will just expand to mod uniffi_types { use {Foo, some_place::Bar}; }
    • assert that the local Foo and crate::uniffi_types::Foo are the same type in the generated code, somehow (shouldn't be very hard)
  • uniffi_bindgen: Read method metadata files and add them to ComponentInterface

Part of #1257.

jplatte avatar Jun 30 '22 17:06 jplatte

I think I'll actually skip the types! macro, it doesn't really do anything better than what it would expand to. That is, I think we should instead require people to define a uniffi_types module using the regular syntax.

jplatte avatar Jul 20 '22 12:07 jplatte

Ready for review! 🎉

jplatte avatar Sep 08 '22 10:09 jplatte

Ah, it looks like we need to generate extra scaffolding code for destructors. I hope the force-push I just did works around that, so this PR can be merged as-is instead of growing more in terms of complexity and code size.

jplatte avatar Sep 08 '22 11:09 jplatte