uniffi-rs
uniffi-rs copied to clipboard
Support Arc<_> and impl blocks in proc-macro frontend
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 tomod uniffi_types { use {Foo, some_place::Bar}; } - assert that the local
Fooandcrate::uniffi_types::Fooare the same type in the generated code, somehow (shouldn't be very hard)
- 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_bindgen: Read method metadata files and add them to
ComponentInterface
Part of #1257.
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.
Ready for review! 🎉
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.