Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is prep work for implementing the system for remote / custom / external types as described in #2087. The generated code should stay exactly the same, this just refactors how it's generated.
Consolidated the
derive_*_for_udl
macros into a singleudl_derive
macro and added theDeriveOptions
struct. I think that we can update UDL-generation to create blanket FFI trait impls by just tweaking which flags we set. We can also re-use the same pattern to implement remote types (which will havegenerate_metadata: true, local_tag: true
).Changed the specific derive code to use
DeriveOptions
plus an item struct. For example RecordItem, which represents the parsed DeriveInput for the record. This will make future changes easier since we only need to modify one of these structs, not update all the function signatures.Changed the UDL derives to parse attributes exactly like regular derives. For example, we now wrap enums with
#[uniffi(flat_error)]
rather than callingderive_error_for_udl!(flat_error)
. This is prep work for remote types -- in that case I think we should tell the user to define the item exactly like it was a regular derive and not special case the attributes.Removed the
#[uniffi(non_exhaustive)]
attribute and parse the real#[non_exhaustive]
attribute instead. This is easy to do now with the new system and also will be good for remote types.Made EnumItem also parse error attributes. I think this is simpler than creating a separate EnumItem vs ErrorItem, at least for now.