Skip to content

BridgeJS: Add support for exporting structs using a box#740

Open
wfltaylor wants to merge 1 commit intoswiftwasm:mainfrom
wfltaylor:boxed-struct
Open

BridgeJS: Add support for exporting structs using a box#740
wfltaylor wants to merge 1 commit intoswiftwasm:mainfrom
wfltaylor:boxed-struct

Conversation

@wfltaylor
Copy link
Copy Markdown
Contributor

Addresses #737

Add an optional structStyle parameter, where using .reference will export the struct as a heap-allocated box. This makes the struct act like a class: @JS must be added to any property which should be exported. Much like a @JS class, JavaScript consumers can call release() to release memory without relying on FinalizationRegistry.

A copy() method is synthesised, so JS consumers can duplicate the struct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant